Now all modules are in core modules folder

This commit is contained in:
Manuel Cillero 2017-08-08 12:14:45 +02:00
parent 5ba1cdfa0b
commit 05b6a91b0c
1907 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,55 @@
<?php
// $Id: calendar-view-ical.tpl.php,v 1.1.2.5 2010/11/21 12:25:12 karens Exp $
/**
* $calname
* The name of the calendar.
* $site_timezone
* The name of the site timezone.
* $events
* An array with the following information about each event:
*
* $event['uid'] - a unique id for the event (usually the url).
* $event['summary'] - the name of the event.
* $event['start'] - the formatted start date of the event.
* $event['end'] - the formatted end date of the event.
* $event['rrule'] - the RRULE of the event, if any.
* $event['timezone'] - the formatted timezone name of the event, if any.
* $event['url'] - the url for the event.
* $event['location'] - the name of the event location.
* $event['description'] - a description of the event.
*
* Note that there are empty spaces after RRULE, URL, LOCATION, etc
* that are needed to make sure we get the required line break.
*
*/
?>
BEGIN:VCALENDAR
VERSION:2.0
METHOD:PUBLISH
X-WR-CALNAME: <?php print $calname . "\r\n"; ?>
PRODID:-//Drupal iCal API//EN
<?php foreach($events as $event): ?>
BEGIN:VEVENT
UID:<?php print($event['uid'] . "\r\n") ?>
SUMMARY:<?php print($event['summary'] . "\r\n") ?>
DTSTAMP:<?php print($current_date . "Z\r\n") ?>
DTSTART:<?php print($event['start'] . "Z\r\n") ?>
<?php if (!empty($event['end'])): ?>
DTEND:<?php print($event['end'] . "Z\r\n") ?>
<?php endif; ?>
<?php if (!empty($event['rrule'])) : ?>
<?php print($event['rrule'] . "\r\n") ?>
<?php endif; ?>
<?php if (!empty($event['url'])): ?>
URL;VALUE=URI:<?php print($event['url'] . "\r\n") ?>
<?php endif; ?>
<?php if (!empty($event['location'])): ?>
LOCATION:<?php print($event['location'] . "\r\n") ?>
<?php endif; ?>
<?php if (!empty($event['description'])) : ?>
DESCRIPTION:<?php print($event['description'] . "\r\n") ?>
<?php endif; ?>
END:VEVENT
<?php endforeach; ?>
END:VCALENDAR

View file

@ -0,0 +1,17 @@
; $Id: calendar_ical.info,v 1.1.2.1 2008/09/05 11:03:42 karens Exp $
name = Calendar iCal
description = Adds ical functionality to Calendar views.
dependencies[] = views
dependencies[] = date_api
dependencies[] = calendar
package = Date/Time
core = 6.x
; Information added by drupal.org packaging script on 2011-01-03
version = "6.x-2.4"
core = "6.x"
project = "calendar"
datestamp = "1294072550"

View file

@ -0,0 +1,54 @@
<?php
// $Id: calendar_ical.install,v 1.1.2.6 2010/02/28 14:23:48 karens Exp $
/**
* Implementation of hook_install().
*/
function calendar_ical_install() {
db_query("UPDATE {system} SET weight = 1 WHERE name = 'calendar_ical'");
}
/**
* Make sure handlers for disabled Calendar iCal module don't get saved in the view.
*/
function calendar_ical_uninstall() {
$displays = array(
'ical',
);
db_query("DELETE FROM {views_display} WHERE display_plugin IN ('". implode("','", $displays) ."')");
db_query("DELETE FROM {cache_views}");
}
function calendar_ical_enable() {
db_query("DELETE FROM {cache_views}");
}
/**
* Make sure handlers for disabled Calendar iCal module don't get saved in the view.
*/
function calendar_ical_disable() {
db_query("DELETE FROM {cache_views}");
}
function calendar_ical_update_last_removed() {
return 1;
}
function calendar_ical_update_6000() {
$ret = array();
$result = db_query("SELECT * FROM {views_display} d LEFT JOIN {views_view} v ON d.vid = v.vid");
drupal_load('module', 'views');
while ($row = db_fetch_array($result)) {
if ($row['display_plugin'] == 'ical') {
$options = unserialize($row['display_options']);
$options['displays'] = array('calendar_1' => 'calendar_1', 'default' => 0, 'calendar_block_1' => 'calendar_block_1');
$row['display_plugin'] = 'calendar_period';
$row['display_options'] = serialize($options);
db_query("UPDATE {views_display} SET id='%s', display_plugin='%s', display_options='%s' WHERE id='%s'", 'calendar_ical_1', 'calendar_ical', $row['display_options'], $row['id']);
db_query("DELETE FROM {views_object_cache} WHERE name = '%s'", $row['name']);
}
}
$ret[] = array('success' => TRUE, 'query' => 'Updated calendar ical displays to use new handlers and ids.');
views_invalidate_cache();
return $ret;
}

View file

@ -0,0 +1,32 @@
<?php
// $Id: calendar_ical.module,v 1.1.2.6 2008/11/24 15:48:15 karens Exp $
/**
* Implementation of hook_views_api().
*
* This one is used as the base to reduce errors when updating.
*/
function calendar_ical_views_api() {
return array(
'api' => 2,
'path' => drupal_get_path('module', 'calendar_ical'),
);
}
/**
* @file
* Adds ical functionality to Calendar.
*/
function calendar_ical_theme() {
return array(
'calendar_ical_icon' => array(
'arguments' => array('url'),
),
);
}
function theme_calendar_ical_icon($url) {
if ($image = theme('image', drupal_get_path('module', 'date_api') .'/images/ical16x16.gif', t('Add to calendar'), t('Add to calendar'))) {
return '<div style="text-align:right"><a href="'. check_url($url) .'" class="ical-icon" title="ical">'. $image .'</a></div>';
}
}

View file

@ -0,0 +1,82 @@
<?php
//$Id: calendar_ical.views.inc,v 1.1.2.6 2009/02/16 23:46:22 karens Exp $
//views_include_handlers();
/**
* Implementation of hook_views_plugins
*/
function calendar_ical_views_plugins() {
$path = drupal_get_path('module', 'calendar_ical');
$views_path = drupal_get_path('module', 'views');
require_once "./$path/theme.inc";
$data = array(
'module' => 'calendar_ical', // This just tells our themes are elsewhere.
'display' => array(
// Parents are not really displays, just needed so the files can
// be included.
'parent' => array(
'no ui' => TRUE,
'handler' => 'views_plugin_display',
'path' => "$views_path/plugins",
'parent' => '',
),
'page' => array(
'no ui' => TRUE,
'handler' => 'views_plugin_display_page',
'path' => "$views_path/plugins",
'parent' => 'parent',
),
'calendar_ical' => array(
'title' => t('iCal feed'),
'help' => t('Display the view as an iCal feed.'),
'handler' => 'calendar_plugin_display_ical',
'path' => "$path",
'parent' => 'page',
'uses hook menu' => TRUE,
'theme' => 'views_view',
'no ui' => TRUE,
'no remove' => TRUE,
'use ajax' => FALSE,
'use pager' => FALSE,
'accept attachments' => FALSE,
'admin' => t('iCal feed'),
'help topic' => 'display-ical',
),
),
'style' => array(
'parent' => array(
// this isn't really a display but is necessary so the file can
// be included.
'no ui' => TRUE,
'handler' => 'views_plugin_style',
'path' => "$views_path/plugins",
'parent' => '',
),
'rss' => array(
// this isn't really a display but is necessary so the file can
// be included.
'no ui' => TRUE,
'handler' => 'views_plugin_style_rss',
'path' => "$views_path/plugins",
'parent' => 'parent',
),
'ical' => array(
'title' => t('iCal feed'),
'help' => t('Generates an iCal feed from a view.'),
'handler' => 'calendar_plugin_style_ical',
'path' => "$path",
'theme' => 'calendar_view_ical',
'theme file' => 'theme.inc',
'theme path' => "$path",
'parent' => 'rss',
'uses row plugin' => FALSE,
'uses fields' => TRUE,
'uses row plugin' => FALSE,
'uses options' => TRUE,
'type' => 'ical',
'even empty' => TRUE,
),
),
);
return $data;
}

View file

@ -0,0 +1,115 @@
<?php
//$Id: calendar_ical_admin.inc,v 1.1.2.2 2008/10/02 20:23:49 karens Exp $
/**
* @file
* Setup and admin functions.
*
* Moved to a separate file so they're not parsed when not needed.
*/
/**
* Setup Calendar feeds.
*
* @todo - control of the stripe color is not yet implemented.
*/
function _calendar_ical_setup_form($view_name) {
require_once('./'. drupal_get_path('module', 'date_api') .'/date_api_ical.inc');
$form = array();
$view = views_get_view($view_name);
$period = drupal_map_assoc(array(0, 3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200, 4838400, 9676800), 'format_interval');
$form['calendar_ical_expire_'. $view->name] = array(
'#type' => 'select', '#title' => t('Expire iCal cache'),
'#default_value' => variable_get('calendar_ical_expire_'. $view->name, 9676800), '#options' => $period,
'#description' => t('iCal feeds are cached to improve performance. Set an expiration time for cached feeds.')
);
$empty_feed = array(0 => array('name' => '', 'url' => '', 'type' => 'ical', 'stripe' => 0));
$form[$view->name] = array(
'#type' => 'fieldset',
'#title' => t('iCal Feeds'),
'#description' => t('Use this section to set up iCal feeds that should be displayed in this calendar. They will be shown along with any internal items that match the calendar criteria.'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#tree' => TRUE,
);
// One empty input form will be added after any existing items.
$view_feeds = array_merge((array) variable_get('calendar_feeds_'. $view->name, $empty_feed), $empty_feed);
foreach ($view_feeds as $delta => $feed) {
$form[$view->name][$delta] = array(
'type' => array(
'#title' => t('Feed type'),
'#type' => 'hidden',
'#value' => 'ical',
),
'name' => array(
'#title' => t('Name'),
'#type' => 'textfield',
'#default_value' => $feed['name'],
'#description' => t('The name of a feed to include in this calendar.'),
),
'url' => array(
'#title' => t('Url'),
'#type' => 'textarea',
'#rows' => 2,
'#default_value' => $feed['url'],
'#description' => t("The external feed url or internal file path and name. Change 'webcal://' to 'http://'."),
),
'calendar_colorpicker' => array(
'#type' => 'calendar_colorpicker',
'#title' => t('Stripe color'),
),
'stripe' => array(
'#type' => 'calendar_colorfield',
'#default_value' => isset($feed['stripe']) ? $feed['stripe'] : '#ffffff',
'#calendar_colorpicker' => $view_name .'-'. $delta .'-calendar-colorpicker',
'#description' => t("The hex color value (like #ffffff) to use for this feed's calendar stripe."),
),
);
}
$form['view_name'] = array(
'#type' => 'hidden',
'#value' => $view->name,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
}
/**
* Save requested values.
*/
function calendar_ical_setup_form_submit($form_id, $form_values) {
$view_name = $form_values['view_name'];
foreach ($form_values as $value_name => $value) {
if ($value_name == 'calendar_ical_expire_'. $view_name) {
variable_set('calendar_ical_expire_'. $view_name, $value);
}
elseif (is_array($value)) {
foreach ($value as $delta => $item) {
// Don't save empty values.
if (trim($item['url']) == '' || trim($item['name']) == '') {
unset($value[$delta]);
}
else {
// Replace 'webcal' protocol with http protocol.
$item['url'] = str_replace('webcal:', 'http:', $item['url']);
// Don't save invalid urls.
$events = date_ical_import($item['url']);
if (!is_array($events)) {
unset($value[$delta]);
}
else {
$value[$delta]['url'] = $item['url'];
}
}
}
variable_set('calendar_feeds_'. $value_name, $value);
}
}
cache_clear_all('calendar_feeds_'. $view->name, calendar_ical_cache(), TRUE);
}

View file

@ -0,0 +1,218 @@
<?php
// $Id: calendar_plugin_display_ical.inc,v 1.1.2.5 2008/11/25 16:12:36 karens Exp $
/**
* The plugin that handles a feed, such as RSS or atom.
*
* For the most part, feeds are page displays but with some subtle differences.
*/
class calendar_plugin_display_ical extends views_plugin_display_page {
function get_style_type() { return 'ical'; }
function uses_breadcrumb() { return FALSE; }
/**
* Feeds do not go through the normal page theming mechanism. Instead, they
* go through their own little theme function and then return NULL so that
* Drupal believes that the page has already rendered itself...which it has.
*/
function execute() {
$output = $this->view->render();
if (empty($output)) {
return drupal_not_found();
}
print $output;
}
function preview() {
return '<pre>' . check_plain($this->view->render()) . '</pre>';
}
/**
* Instead of going through the standard views_view.tpl.php, delegate this
* to the style handler.
*/
function render() {
return $this->view->style_plugin->render($this->view->result);
}
function defaultable_sections($section = NULL) {
if (in_array($section, array('style_options', 'style_plugin', 'row_options', 'row_plugin',))) {
return FALSE;
}
$sections = parent::defaultable_sections($section);
// Tell views our sitename_title option belongs in the title section.
if ($section == 'title') {
$sections[] = 'sitename_title';
}
elseif (!$section) {
$sections['title'][] = 'sitename_title';
}
return $sections;
}
function option_definition() {
$options = parent::option_definition();
$options['displays'] = array('default' => array());
// Overrides for standard stuff:
$options['style_plugin']['default'] = 'rss';
$options['style_options']['default'] = array('mission_description' => FALSE, 'description' => '');
$options['sitename_title']['default'] = FALSE;
$options['row_plugin']['default'] = '';
$options['defaults']['default']['style_plugin'] = FALSE;
$options['defaults']['default']['style_options'] = FALSE;
$options['defaults']['default']['row_plugin'] = FALSE;
$options['defaults']['default']['row_options'] = FALSE;
return $options;
}
function options_summary(&$categories, &$options) {
// It is very important to call the parent function here:
parent::options_summary($categories, $options);
// Since we're childing off the 'page' type, we'll still *call* our
// category 'page' but let's override it so it says feed settings.
$categories['page'] = array(
'title' => t('iCal settings'),
);
if ($this->get_option('sitename_title')) {
$options['title']['value'] = t('Using the site name');
}
// I don't think we want to give feeds menus directly.
unset($options['menu']);
$displays = array_filter($this->get_option('displays'));
if (count($displays) > 1) {
$attach_to = t('Multiple displays');
}
else if (count($displays) == 1) {
$display = array_shift($displays);
if (!empty($this->view->display[$display])) {
$attach_to = $this->view->display[$display]->display_title;
}
}
if (!isset($attach_to)) {
$attach_to = t('None');
}
$options['displays'] = array(
'category' => 'page',
'title' => t('Attach to'),
'value' => $attach_to,
);
}
/**
* Provide the default form for setting options.
*/
function options_form(&$form, &$form_state) {
// It is very important to call the parent function here.
parent::options_form($form, $form_state);
switch ($form_state['section']) {
case 'title':
$title = $form['title'];
// A little juggling to move the 'title' field beyond our checkbox.
unset($form['title']);
$form['sitename_title'] = array(
'#type' => 'checkbox',
'#title' => t('Use the site name for the title'),
'#default_value' => $this->get_option('sitename_title'),
);
$form['title'] = $title;
$form['title']['#process'] = array('views_process_dependency');
$form['title']['#dependency'] = array('edit-sitename-title' => array(FALSE));
break;
case 'displays':
$form['#title'] .= t('Attach to');
$displays = array();
foreach ($this->view->display as $display_id => $display) {
if (!empty($display->handler) && $display->handler->accept_attachments()) {
$displays[$display_id] = $display->display_title;
}
}
$form['displays'] = array(
'#type' => 'checkboxes',
'#description' => t('The ical icon will be shown only on the selected displays.'),
'#options' => $displays,
'#default_value' => $this->get_option('displays'),
);
break;
case 'path':
$form['path']['#description'] = t('This view will be displayed by visiting this path on your site. It is recommended that the path be something like "path/%/%/ical", putting one % in the path for each argument you have defined in the view.');
break;
}
}
/**
* Perform any necessary changes to the form values prior to storage.
* There is no need for this function to actually store the data.
*/
function options_submit($form, &$form_state) {
// It is very important to call the parent function here:
parent::options_submit($form, $form_state);
switch ($form_state['section']) {
case 'title':
$this->set_option('sitename_title', $form_state['values']['sitename_title']);
break;
case 'displays':
$this->set_option($form_state['section'], $form_state['values'][$form_state['section']]);
break;
}
}
/**
* Attach to another view.
*/
function attach_to($display_id) {
$displays = $this->get_option('displays');
if (empty($displays[$display_id])) {
return;
}
// Defer to the feed style; it may put in meta information, and/or
// attach a feed icon.
$plugin = $this->get_plugin();
if ($plugin) {
$clone = $this->view->clone_view();
$clone->set_display($this->display->id);
$clone->build_title();
$plugin->attach_to($display_id, $this->get_path(), $clone->get_title());
}
}
/**
* Display validation.
*/
function validate() {
$errors = parent::validate();
$arguments = $this->display->handler->get_option('arguments');
$filters = $this->display->handler->get_option('filters');
if (!array_key_exists('date_argument', $arguments) && !array_key_exists('date_filter', $filters)) {
if (empty($this->view->date_info->arg_missing)) {
$errors[] = t("A Calendar period display will not work without a Date argument or a Date filter.");
}
$this->view->date_info->arg_missing = TRUE;
}
if (array_key_exists('date_argument', $arguments) &&
($arguments['date_argument']['default_action'] != 'default' || $arguments['date_argument']['default_argument_type'] != 'date')) {
if (empty($this->view->date_info->arg_missing_default)) {
$errors[] = calendar_errors('missing_argument_default');
}
$this->view->date_info->arg_missing_default = TRUE;
}
return $errors;
}
}

View file

@ -0,0 +1,254 @@
<?php
// $Id: calendar_plugin_style_ical.inc,v 1.1.2.17 2009/04/28 22:47:29 karens Exp $
/**
* Default style plugin to render an iCal feed.
*/
class calendar_plugin_style_ical extends views_plugin_style_rss {
function init(&$view, &$display) {
parent::init($view, $display);
$fields = $display->handler->default_display->options['fields'];
$this->options['fields'] = $fields;
}
function query() {
// We need these values for the iCal feed.
$this->view->query->add_field('node', 'title');
$this->view->query->add_field('node', 'type');
parent::query();
}
function attach_to($display_id, $path, $title) {
$display = $this->view->display[$display_id]->handler;
$url_options = array();
$input = $this->view->get_exposed_input();
if ($input) {
$url_options['query'] = $input;
}
// TODO adjust this to pick up default values when no arg is set?
$url = url($this->view->get_url(NULL, $path), $url_options);
if (empty($this->view->feed_icon)) {
$this->view->feed_icon = '';
}
$this->view->feed_icon .= theme('calendar_ical_icon', $url);
drupal_add_link(array(
'rel' => 'alternate',
'type' => 'application/calendar',
'title' => $title,
'href' => $url
));
}
/**
* Set default options
*/
function options(&$options) {
parent::options($options);
$options['summary_field'] = 'title';
$options['description_field'] = '';
$options['location_field'] = '';
$options['fields'] = array();
}
function option_definition() {
$options = parent::option_definition();
$options['summary_field'] = array('default' => '', 'translatable' => TRUE);
$options['description_field'] = array('default' => '', 'translatable' => TRUE);
$options['location_field'] = array('default' => '', 'translatable' => TRUE);
return $options;
}
function options_form(&$form, &$form_state) {
$options = array('' => '');
foreach ($this->options['fields'] as $field) {
$handler = views_get_handler($field['table'], $field['field'], 'field');
$options[$field['field']] = $handler->ui_name();
}
$form['#prefix'] = '<div class="form-item">'. t("Map the View fields to the values they should represent in the iCal feed. Only fields that have been added to the view are available to use in this way. You can add additional fields to the view and mark them 'Exclude from display' if you only want them in the iCal feed.") .'</div>';
$form['summary_field'] = array(
'#type' => 'select',
'#title' => t('Title'),
'#default_value' => !empty($this->options['summary_field']) ? $this->options['summary_field'] : 'title',
'#options' => $options,
'#required' => TRUE,
);
$form['description_field'] = array(
'#type' => 'select',
'#title' => t('Description'),
'#default_value' => $this->options['description_field'],
'#options' => $options,
);
$form['location_field'] = array(
'#type' => 'select',
'#title' => t('Location'),
'#default_value' => $this->options['location_field'],
'#options' => $options,
);
}
/**
* Style validation.
*/
function validate() {
$errors = parent::validate();
$style = $this->display->display_options['style_plugin'];
$arguments = $this->display->handler->get_option('arguments');
$filters = $this->display->handler->get_option('filters');
if (!array_key_exists('date_argument', $arguments) && !array_key_exists('date_filter', $filters)) {
if (empty($this->view->date_info->arg_missing)) {
$errors[$style] = t("The @style style requires a Date argument or a Date filter.", array('@style' => $style));
}
$this->view->date_info->arg_missing = TRUE;
}
if (array_key_exists('date_argument', $arguments) &&
($arguments['date_argument']['default_action'] != 'default' || $arguments['date_argument']['default_argument_type'] != 'date')) {
if (empty($this->view->date_info->arg_missing_default)) {
$errors[] = calendar_errors('missing_argument_default');
}
$this->view->date_info->arg_missing_default = TRUE;
}
if (empty($this->options['summary_field'])) {
$errors[] = $errors[$style] = t("The @style style requires a Title field for the iCal export.", array('@style' => $style));
}
// Make sure date fields are not set up to 'Group multiple values'
// in the calendar style.
if ($style == 'calendar_style') {
$view_fields = date_api_fields($this->view->base_table);
$view_fields = $view_fields['name'];
$fields = $this->display->handler->get_option('fields');
foreach ($fields as $column => $field) {
$field_name = $field['table'] .".". $field['field'];
if (!empty($field['multiple'])) {
$cck_fields = content_fields();
$real_name = $view_fields[$field_name]['real_field_name'];
if ($cck_fields[$real_name]['multiple'] && !empty($field['multiple']['group'])) {
$errors[] = t("The date field '@field' used by the display '@display_title' cannot be set to 'Group multiple values'.", array('@field' => $view_fields[$field_name]['label'], '@display_title' => $this->display->display_title));
}
}
}
}
return $errors;
}
function render() {
require_once('./'. drupal_get_path('module', 'calendar') .'/includes/calendar.inc');
// Transfer the style options to the view object so they
// can be easily accessed in the theme.
$style_options = $this->options;
$this->view->date_info->summary_field = $style_options['summary_field'];
$this->view->date_info->description_field = $style_options['description_field'];
$this->view->date_info->location_field = $style_options['location_field'];
// Evaluate our argument values and figure out which
// calendar display we need to create.
$i = 0;
foreach ($this->view->argument as $id => $argument) {
if ($argument->field == 'date_argument') {
// TODO Decide if we want to provide a date here or not.
// Adding this now is to prevent fatal errors later if the
// view is used in unexpected ways without a date being set.
if (empty($argument->min_date)) {
$value = $argument->get_default_argument();
$range = $argument->date_handler->arg_range($value);
$argument->min_date = $range[0];
$argument->max_date = $range[1];
}
$this->view->date_info->granularity = !empty($argument->granularity) ? $argument->granularity : $argument->options['granularity'];
$this->view->date_info->date_arg = !empty($this->view->args) ? $this->view->args[$argument->position] : '';
$this->view->date_info->date_arg_pos = $i;
$this->view->date_info->year = isset($argument->year) ? $argument->year : NULL;
$this->view->date_info->month = isset($argument->month) ? $argument->month: NULL;
$this->view->date_info->day = isset($argument->day) ? $argument->day : NULL;
$this->view->date_info->week = isset($argument->week) ? $argument->week : NULL;
$this->view->date_info->min_date = $argument->min_date;
$this->view->date_info->max_date = $argument->max_date;
// Stop after the first date argument, if there is more than one.
break;
}
$i++;
}
// The ical display might have date filters instead of arguments.
// If we missed getting a min date from date arguments, try date filters.
if (empty($this->view->date_info->min_date)) {
foreach ($this->view->filter as $id => $filter) {
if ($filter->field == 'date_filter') {
// TODO Decide if we want to provide a date here or not.
// Adding this now is to prevent fatal errors later if the
// view is used in unexpected ways without a date being set.
if (empty($filter->min_date)) {
$value = $filter->default_value('value');
$range = $filter->date_handler->arg_range($value);
$filter->min_date = $range[0];
$filter->max_date = $range[1];
}
$this->view->date_info->granularity = !empty($filter->granularity) ? $filter->granularity : $filter->options['granularity'];
$this->view->date_info->year = isset($filter->year) ? $filter->year : NULL;
$this->view->date_info->month = isset($filter->month) ? $filter->month: NULL;
$this->view->date_info->day = isset($filter->day) ? $filter->day : NULL;
$this->view->date_info->week = isset($filter->week) ? $filter->week : NULL;
$this->view->date_info->min_date = $filter->min_date;
$this->view->date_info->max_date = $filter->max_date;
if (empty($this->view->date_info->date_fields)) {
$this->view->date_info->date_fields = array();
}
$this->view->date_info->date_fields = array_merge($this->view->date_info->date_fields, array_keys($filter->options['date_fields']));
// Stop after the first date filter, if there is more than one.
break;
}
}
$i++;
}
// Render each field into an output array.
$items = array();
$calendar_fields = date_api_fields($this->view->base_table);
$calendar_fields = array_keys($calendar_fields['alias']);
foreach ($this->view->result as $num => $row) {
$items[$num] = $row;
// Store the raw date values before formatting the results.
foreach ($row as $key => $value) {
if (in_array($key, $calendar_fields)) {
$items[$num]->calendar_fields->$key = $value;
}
}
foreach ($this->view->field as $name => $field) {
// Some fields, like the node edit and delete links, have no alias.
$field_alias = $field->field_alias != 'unknown' ? $field->field_alias : $name;
if (!empty($field) && is_object($field)) {
$field_output = $field->theme($row);
$items[$num]->{$field_alias} = $field_output;
}
}
}
// Massage the resulting items into formatted calendar items.
$items = calendar_build_nodes($this->view, $items);
// Merge in items from other sources.
foreach (module_implements('calendar_add_items') as $module) {
$function = $module .'_calendar_add_items';
if (function_exists($function)) {
if ($feeds = $function($this->view)) {
foreach ($feeds as $feed) {
$items = $feed;
}
}
}
}
return theme($this->theme_functions(), $this->view, $this->options, $items);
}
}

View file

@ -0,0 +1,81 @@
<?php
// $Id: theme.inc,v 1.1.2.15 2010/11/21 11:00:56 karens Exp $
/**
* Preprocess an ical feed
*/
function template_preprocess_calendar_view_ical(&$vars) {
global $base_url;
global $language;
$view = &$vars['view'];
$options = &$vars['options'];
$items = &$vars['rows'];
$style = &$view->style_plugin;
// Figure out which display which has a path we're using for this feed. If there isn't
// one, use the global $base_url
$link_display = $view->display_handler->get_link_display();
// Compare the link to the default home page; if it's the default home page, just use $base_url.
if (empty($vars['link'])) {
$vars['link'] = $base_url;
}
// Keep devel module from appending queries to ical export.
$GLOBALS['devel_shutdown'] = FALSE;
drupal_set_header('Content-Type: text/calendar; charset=utf-8');
drupal_set_header('Content-Disposition: attachment; filename="calendar.ics"; ');
require_once('./'. drupal_get_path('module', 'date_api') .'/date_api_ical.inc');
require_once('./'. drupal_get_path('module', 'date_api') .'/theme/theme.inc');
require_once('./'. drupal_get_path('module', 'calendar') .'/includes/calendar.inc');
$events = array();
// Get the alias name for each of our data fields.
foreach ($view->field as $name => $field) {
// Some fields, like the node edit and delete links, have no alias.
$field_alias = $field->field_alias != 'unknown' ? $field->field_alias : $name;
foreach (array('summary_field', 'description_field', 'location_field') as $data) {
if ($field->field == $view->date_info->$data) {
$$data = $field_alias;
}
}
}
// A summary field is required, default to the title.
if (empty($summary_field) || $summary_field == 'node_title') {
$summary_field = 'title';
}
foreach ($items as $node) {
// We cannot process an event that is missing the summary info.
if (empty($node->$summary_field)) {
continue;
}
// Allow modules to affect item fields
node_invoke_nodeapi($node, 'ical item');
unset($node->view);
$rrule_field = str_replace(array('_value2', '_value'), '_rrule', $node->datefield);
$event = array();
$event['summary'] = strip_tags($node->$summary_field);
$event['start'] = $node->calendar_start_date;
$event['end'] = $node->calendar_end_date;
$event['description'] = !empty($description_field) && !empty($node->$description_field) ? $node->$description_field : '';
$event['location'] = !empty($location_field) && !empty($node->$location_field) ? $node->$location_field : '';
$event['url'] = !empty($node->url) ? $node->url : (is_numeric($node->nid) ? url("node/$node->nid", array('absolute' => TRUE)) : $node->nid);
$event['uid'] = !empty($node->date_id) ? $node->date_id : $event['url'];
$event['rrule'] = !empty($rrule_field) && !empty($node->$rrule_field) ? $node->$rrule_field : '';
$events[$event['uid']] = $event;
/* force UTC timezone */
date_timezone_set($event['start'], timezone_open('UTC'));
date_timezone_set($event['end'], timezone_open('UTC'));
}
$headertitle = filter_xss_admin($view->get_title());
$title = variable_get('site_name', 'Drupal');
$description = $headertitle . ($title ? ' | '. $title : '');
$vars['calname'] = $description;
$vars['events'] = $events;
template_preprocess_date_vcalendar($vars);
}

View file

@ -0,0 +1,117 @@
# $Id: calendar_ical.cs.po,v 1.1.2.1 2010/10/22 20:06:37 wojtha Exp $
#
# Czech translation of Calendar (6.x-2.2)
# Copyright (c) 2010 by the Czech translation team
#
msgid ""
msgstr ""
"Project-Id-Version: Calendar (6.x-2.2)\n"
"POT-Creation-Date: 2010-10-22 20:03+0000\n"
"PO-Revision-Date: 2010-10-07 16:49+0000\n"
"Language-Team: Czech\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=((((n%10)==1)&&((n%100)!=11))?(0):(((((n%10)>=2)&&((n%10)<=4))&&(((n%100)<10)||((n%100)>=20)))?(1):2));\n"
msgid "Title"
msgstr "Nadpis"
msgid "Submit"
msgstr "Uložit"
msgid "Description"
msgstr "Popis"
msgid "Name"
msgstr "Jméno"
msgid "Url"
msgstr "Url"
msgid "Location"
msgstr "Místo"
msgid "Feed type"
msgstr "Typ zdroje"
msgid "Expire iCal cache"
msgstr "Expirace iCal mezipaměti."
msgid ""
"iCal feeds are cached to improve performance. Set an expiration time "
"for cached feeds."
msgstr ""
"Pro zlepšení výkonu jsou iCal zdroje ukládány do mezipaměti. "
"Nastavte čas expirace."
msgid "iCal Feeds"
msgstr "iCal zdroje (Feeds)"
msgid ""
"Use this section to set up iCal feeds that should be displayed in this "
"calendar. They will be shown along with any internal items that match "
"the calendar criteria."
msgstr ""
"Tato sekce slouží pro nastavení iCal zdrojů, které budou v "
"kalendáři zobrazeny. Data načtená ze zdrojů budou součástí "
"všech interních položek, které odpovídají kritériím "
"kalendáře."
msgid "The name of a feed to include in this calendar."
msgstr "Název zdroje, který má být zahrnut do kalendáře."
msgid ""
"The external feed url or internal file path and name. Change "
"'webcal://' to 'http://'."
msgstr ""
"URL externího zdroje nebo interní cesta a jméno souboru. Změňte "
"'webcal://' na 'http://'."
msgid "Add to calendar"
msgstr "Přidat do kalendáře"
msgid "Calendar iCal"
msgstr "Kalendář iCal"
msgid "Attach to"
msgstr "Přiložit k"
msgid "Stripe color"
msgstr "Barva pruhu"
msgid ""
"The hex color value (like #ffffff) to use for this feed's calendar "
"stripe."
msgstr ""
"Barva v šestnáctkovém zápisu (např. #ffffff), která se má "
"použít pro tento pruh."
msgid "Adds ical functionality to Calendar views."
msgstr "Přidá podporu iCal zdrojů do kalendářových pohledů."
msgid "Multiple displays"
msgstr "Více zobrazení"
msgid "Using the site name"
msgstr "Použití jména webu"
msgid "Use the site name for the title"
msgstr "Jako název použít název webu"
msgid "iCal feed"
msgstr "iCal zdroj"
msgid "Display the view as an iCal feed."
msgstr "Zobrazit výstup z pohledu jako iCal zdroj."
msgid "Generates an iCal feed from a view."
msgstr "Jako výstup z pohledu generovat iCal zdroj."
msgid "iCal settings"
msgstr "Nastavení pro iCal"
msgid "The ical icon will be shown only on the selected displays."
msgstr "Ikona ical bude viditelná pouze u vybraných zobrazení."
msgid ""
"This view will be displayed by visiting this path on your site. It is "
"recommended that the path be something like \"path/%/%/ical\", putting "
"one % in the path for each argument you have defined in the view."
msgstr ""
"Na zde definované adrese bude zobrazen konfigurovaný pohled. Je "
"vhodné, aby adresa měla tvar \"path/%/%/ical\", kde % reprezentuje "
"jednotlivé argumenty."
msgid ""
"A Calendar period display will not work without a Date argument or a "
"Date filter."
msgstr ""
"Pokud nebude definován argument s datumem nebo datumový filtr, potom "
"nebude zobrazení časového intervalu (period display) pracovat."
msgid ""
"Map the View fields to the values they should represent in the iCal "
"feed. Only fields that have been added to the view are available to "
"use in this way. You can add additional fields to the view and mark "
"them 'Exclude from display' if you only want them in the iCal feed."
msgstr ""
"Namapujte hodnoty z iCal zdroje na relevantní pole. Mapovat lze pouze "
"ta pole, která byla přidána v konfiguraci pohledu (view). Pokud si "
"přejete pracovat s poli pouze v rámci mapování s výhodou můžete "
"použít volby 'nezobrazovat' ('Exclude from display')."
msgid "The @style style requires a Date argument or a Date filter."
msgstr "Styl @style vyžaduje argument nebo filtr typu \"datum\"."
msgid "The @style style requires a Title field for the iCal export."
msgstr "Styl @style vyžaduje pole 'Nadpis' pro iCal export."

View file

@ -0,0 +1,70 @@
# Hungarian translation of Calendar (all releases)
# Copyright (c) 2009 by the Hungarian translation team
#
msgid ""
msgstr ""
"Project-Id-Version: Calendar (all releases)\n"
"POT-Creation-Date: 2009-11-10 16:39+0000\n"
"PO-Revision-Date: 2009-11-10 14:07+0000\n"
"Language-Team: Hungarian\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n!=1);\n"
msgid "Title"
msgstr "Cím"
msgid "Description"
msgstr "Leírás"
msgid "Location"
msgstr "Hely"
msgid "Attach to"
msgstr "Csatolás ehhez"
msgid "Multiple displays"
msgstr "Öszzetett képernyők"
msgid "Using the site name"
msgstr "Használva a webhely nevét"
msgid "Use the site name for the title"
msgstr "A webhely nevét használja címnek"
msgid "iCal feed"
msgstr "iCal hírcsatorna"
msgid "Display the view as an iCal feed."
msgstr "Nézet megjelenítése iCal hírcsatornaként."
msgid "Generates an iCal feed from a view."
msgstr "iCal hírcsatorna előállítása nézetből."
msgid "iCal settings"
msgstr "iCal beállításai"
msgid "The ical icon will be shown only on the selected displays."
msgstr "Az ical ikon csak a kiválasztott képernyőkön fog megjelenni."
msgid ""
"This view will be displayed by visiting this path on your site. It is "
"recommended that the path be something like \"path/%/%/ical\", putting "
"one % in the path for each argument you have defined in the view."
msgstr ""
"Ez a nézet ezen az útvonalon lesz megtekinthető az oldalon. "
"Javasolt az elérési út „path/%/%/ical” szerű megadása, "
"egy-egy % jelet elhelyezve az elérési útban minden, a nézetben "
"meghatározott argumentumhoz."
msgid ""
"A Calendar period display will not work without a Date argument or a "
"Date filter."
msgstr ""
"Naptári időszak képernyő nem működik egy Dátum argumentum vagy "
"egy Dátum szűrő nélkül."
msgid ""
"Map the View fields to the values they should represent in the iCal "
"feed. Only fields that have been added to the view are available to "
"use in this way. You can add additional fields to the view and mark "
"them 'Exclude from display' if you only want them in the iCal feed."
msgstr ""
"Leképezi a View mezőket az iCal hírcsatornában ábrázolandó "
"értékekre. Ezen a módon csak a nézethez hozzáadott mezők lesznek "
"elérhetőek. További mezőket lehet hozzáadni a nézethez, amiket "
"„Megjelenítésből kizárt”-nak kell jelölni, ha azokat csak az "
"iCal hírcsatornában kívánjuk megjeleníteni."
msgid "The @style style requires a Date argument or a Date filter."
msgstr ""
"@style stílushoz szükséges egy Dátum argumentum vagy egy Dátum "
"szűrő."
msgid "The @style style requires a Title field for the iCal export."
msgstr "@style stílusnak szüksége van egy Cím mezőre az iCal exporthoz."

View file

@ -0,0 +1,169 @@
# $Id: calendar_ical.pot,v 1.1.2.2 2009/02/17 11:06:21 karens Exp $
#
# LANGUAGE translation of Drupal (general)
# Copyright YEAR NAME <EMAIL@ADDRESS>
# Generated from files:
# calendar_ical.views.inc,v 1.1.2.6 2009/02/16 23:46:22 karens
# calendar_ical_admin.inc,v 1.1.2.2 2008/10/02 20:23:49 karens
# calendar_plugin_display_ical.inc,v 1.1.2.5 2008/11/25 16:12:36 karens
# calendar_plugin_style_ical.inc,v 1.1.2.13 2009/02/16 11:39:37 karens
# calendar_ical.module,v 1.1.2.6 2008/11/24 15:48:15 karens
# calendar_ical.info,v 1.1.2.1 2008/09/05 11:03:42 karens
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2009-02-17 05:03-0600\n"
"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
"Last-Translator: NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
#: calendar_ical.views.inc:30;42;64
msgid "iCal feed"
msgstr ""
#: calendar_ical.views.inc:31
msgid "Display the view as an iCal feed."
msgstr ""
#: calendar_ical.views.inc:65
msgid "Generates an iCal feed from a view."
msgstr ""
#: calendar_ical_admin.inc:22
msgid "Expire iCal cache"
msgstr ""
#: calendar_ical_admin.inc:24
msgid "iCal feeds are cached to improve performance. Set an expiration time for cached feeds."
msgstr ""
#: calendar_ical_admin.inc:30
msgid "iCal Feeds"
msgstr ""
#: calendar_ical_admin.inc:31
msgid "Use this section to set up iCal feeds that should be displayed in this calendar. They will be shown along with any internal items that match the calendar criteria."
msgstr ""
#: calendar_ical_admin.inc:42
msgid "Feed type"
msgstr ""
#: calendar_ical_admin.inc:47
msgid "Name"
msgstr ""
#: calendar_ical_admin.inc:50
msgid "The name of a feed to include in this calendar."
msgstr ""
#: calendar_ical_admin.inc:53
msgid "Url"
msgstr ""
#: calendar_ical_admin.inc:57
msgid "The external feed url or internal file path and name. Change 'webcal://' to 'http://'."
msgstr ""
#: calendar_ical_admin.inc:61
msgid "Stripe color"
msgstr ""
#: calendar_ical_admin.inc:67
msgid "The hex color value (like #ffffff) to use for this feed's calendar stripe."
msgstr ""
#: calendar_ical_admin.inc:77
msgid "Submit"
msgstr ""
#: calendar_plugin_display_ical.inc:81
msgid "iCal settings"
msgstr ""
#: calendar_plugin_display_ical.inc:85
msgid "Using the site name"
msgstr ""
#: calendar_plugin_display_ical.inc:93
msgid "Multiple displays"
msgstr ""
#: calendar_plugin_display_ical.inc:103
msgid "None"
msgstr ""
#: calendar_plugin_display_ical.inc:108;135
msgid "Attach to"
msgstr ""
#: calendar_plugin_display_ical.inc:127
msgid "Use the site name for the title"
msgstr ""
#: calendar_plugin_display_ical.inc:144
msgid "The ical icon will be shown only on the selected displays."
msgstr ""
#: calendar_plugin_display_ical.inc:150
msgid "This view will be displayed by visiting this path on your site. It is recommended that the path be something like \"path/%/%/ical\", putting one % in the path for each argument you have defined in the view."
msgstr ""
#: calendar_plugin_display_ical.inc:203
msgid "A Calendar period display will not work without a Date argument or a Date filter."
msgstr ""
#: calendar_plugin_style_ical.inc:70
msgid "Map the View fields to the values they should represent in the iCal feed. Only fields that have been added to the view are available to use in this way. You can add additional fields to the view and mark them 'Exclude from display' if you only want them in the iCal feed."
msgstr ""
#: calendar_plugin_style_ical.inc:74
msgid "Title"
msgstr ""
#: calendar_plugin_style_ical.inc:81
msgid "Description"
msgstr ""
#: calendar_plugin_style_ical.inc:87
msgid "Location"
msgstr ""
#: calendar_plugin_style_ical.inc:107
msgid "The @style style requires a Date argument or a Date filter."
msgstr ""
#: calendar_plugin_style_ical.inc:120
msgid "The @style style requires a Title field for the iCal export."
msgstr ""
#: calendar_plugin_style_ical.inc:134
msgid "The date field '@field' used by the display '@display_title' cannot be set to 'Group multiple values'."
msgstr ""
#: calendar_ical.module:29;29
msgid "Add to calendar"
msgstr ""
#: calendar_ical.module:0
msgid "calendar_ical"
msgstr ""
#: calendar_ical.info:0
msgid "Calendar iCal"
msgstr ""
#: calendar_ical.info:0
msgid "Adds ical functionality to Calendar views."
msgstr ""
#: calendar_ical.info:0
msgid "Date/Time"
msgstr ""