Skip to content

Commit

Permalink
Merge in fixes and additions from the latest openoutreach code as in …
Browse files Browse the repository at this point in the history
…the beta7 release.
  • Loading branch information
Nedjo Rogers committed Jan 9, 2012
1 parent 7576600 commit 88b4a49
Show file tree
Hide file tree
Showing 406 changed files with 6,653 additions and 3,387 deletions.
60 changes: 41 additions & 19 deletions profiles/openoutreach/modules/contrib/calendar/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,38 @@ Calendar Module 7.x
Version 7.x-3.x-dev
===================

- Issue #1354560, Add a new plugin that works for all entities, not just nodes and mark the old one as deprecated.
- Follow up to Issue #1302052 by benjifisher, More clean up of ical line endings.

======================
Version 7.x-3.0-alpha2
======================

NOTES:
The links at the top of the calendar page have been reworked into tabs. They will not show up
until you clear the caches. Use hook_calendar_links_alter() to alter the links or the titles
until you clear the caches. Use hook_calendar_links_alter() to alter the links or the titles
or to empty the links array if you don't want to see them.

- Issue #1302052 by benjifisher, penguin25, and helmo, Fix linespace ending problems in ical files.
- Issue #704068, Avoid undefined variable error by not returning a value we don't even need.
- Issue #1388364, Do some clean up of the handling for taxonomy stripes.
- Issue #1303458. Make sure calendar tabs work right without clean urls.
- Issue #1270538, Fix notice for missing index 'access'.
- Issue #1259870, Reinstate the test for a missing date argument for the pager and add to the message a warning that the problem could be that the default date is missing from the argument.
- Issue #1305938 by kristiaanvandeneynde and KarenS, Make sure the overlapping items work correctly with half hour grouping, and don't allow it for custom time groupings.
- Issue #1259992 by jlyon, slerby, and KarenS, The maximum items processing was not working right.
- Issue #1260380, Some items showing up in wrong time periods because wrong value is used to create the start date bucket.
- Issue #1292148, Make scrolling in day and week view optional.
- Issue #462748, Make sure calendar links can be deleted as well as created.
- Issue #1301734 by Danny_Joris, Do not show any links to disabled displays.
- Issue #1383782 by googletorp, Check if module_exists('taxonomy') before creating taxonomy strip options.
- Issue #1235344 by kenianbei, Make sure items don't overlap if they start and end on the same times.
- Issue #1323280 by mshepherd, Remove time from time headers.
- Issue #1322376 by mshepherd, Remove space between hour and am/pm in day and week views.
- Issue #1230500, The calendar row logic was failing if there was more than one date field in a node due to a bad return value. Also fixed some errors caused by not returning an empty array for missing values.
- Issue #1236610, Allow the calendar style to work with any row plugin that extends the calendar_row_plugin.
- Issue #1265590, The calendar tabs were not showing up for everyone.
- Issue #1312792, Rework language handling for the calendar row plugin.
- Issue #1315328, Default calendar had date arguments in the master, which affected the upcoming view.
- Issue #1268780 by drewkeller, $part_path in calendar_preprocess_date_views_pager() seems to be incorrect when base_path() is '/'
- Issue #1235180 by marleythedog, Fix broken taxonomy stripe handling in calendar row plugin.
Expand All @@ -24,14 +51,6 @@ or to empty the links array if you don't want to see them.
- Issue #1254922 by larsdesigns, calendar_multiday.css is not complient with Drupal Coding Standards
- Issue #1254920 by larsdesigns, calendar.css is not complient with Drupal Coding Standards
- Issue #1254916 by larsdesigns, calendar-overlap.css is not complient with Drupal Coding Standards

Starting new branch with a total rework of Calendar, using a Views pager plugin for the back/next navigation,
a row plugin to explode the view results into calendar day items, and a style plugin to disply the results in a calendar.

======================
Version 7.x-3.0-alpha2
======================

- Add update hook to remove old style calendar legend blocks from system.
- Issue #742146, Add option to remove X-WR-CALNAME if VEVENT is not a feed.
- Add option to change method from PUBLISH to REQUEST in VCALENDAR.
Expand All @@ -49,6 +68,9 @@ Version 7.x-3.0-alpha1

Initial release of 7.3 branch.

Starting new branch with a total rework of Calendar, using a Views pager plugin for the back/next navigation,
a row plugin to explode the view results into calendar day items, and a style plugin to disply the results in a calendar.

- Get colorpicker working again with an assist from the Examples module Field example.
- Issue #1227128 The ical feed needs to have a '.ics' extension on it.
- The ical icon was not attaching to block views.
Expand Down Expand Up @@ -155,21 +177,21 @@ Abandoned the 7.x-1.x branch.

Start a new 7.x-2.x branch that will contain a complete re-work of the Views handling.

The 7.x-2.x branch will totally re-work and simplify the Views filters. These changes may/will
break some views and will require that you check views that use the date filter or
The 7.x-2.x branch will totally re-work and simplify the Views filters. These changes may/will
break some views and will require that you check views that use the date filter or
argument to be sure they are still configured correctly.

There is a new date_filter_handler_simple for an individual date field that simplifies
the Views handling by using most of the core Views field handling but adds in the
possibility to set a default date using options like 'now', along with a choice of a
There is a new date_filter_handler_simple for an individual date field that simplifies
the Views handling by using most of the core Views field handling but adds in the
possibility to set a default date using options like 'now', along with a choice of a
month/day/year drop-down selector or popup calendar selector.

The date_filter_handler is an extension of the simple handler that allows you to combine
multiple dates into a single filter so that you can control all of them with the same
The date_filter_handler is an extension of the simple handler that allows you to combine
multiple dates into a single filter so that you can control all of them with the same
filter widget, allowing you to either 'OR' or 'AND' them together.

The arguments will be rewritten in the same way, with a simple argument handler for
individual dates and another handler that extends that to control multiple dates with
The arguments will be rewritten in the same way, with a simple argument handler for
individual dates and another handler that extends that to control multiple dates with
a single argument.

=======================
Expand All @@ -182,7 +204,7 @@ Argh! Fixing the field handling broke the handling for system dates. Try again.
Version 7.x-1.0-alpha2
=======================

Views made lots of changes to field handling just before the new release, which broke lots of things here.
Views made lots of changes to field handling just before the new release, which broke lots of things here.
Adding some work-arounds to get things working again and waiting until the dust settles on how the new core fields will be handled in Views before doing much more with the Views integration. These changes should get things working with latest Views release.

=======================
Expand Down
8 changes: 4 additions & 4 deletions profiles/openoutreach/modules/contrib/calendar/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Creates calendar displays of Views results.

Create a new calendar by enabling or cloning the default calendar,
changing the date argument to use the correct date field(s), and setting
up the year, month, day, week, and block views with the desired styles
up the year, month, day, week, and block views with the desired styles
and fields.

If the Calendar iCal module is enabled, an iCal feed can be
Expand All @@ -18,12 +18,12 @@ NOTES WHEN SWITCHING FROM 7.2 to 7.3

The views created in the 7.2 version of Calendar won't work in 7.3
because all the handlers have changed. If you are using the default
view, you will need to revert it to pick up the changes.
view, you will need to revert it to pick up the changes.

If you have calendars that were created by the Date Tools module, they are
default views. Go to each one and revert them so they pick up the new code.

If you are using custom (non-default) views it will probably be easier to
If you are using custom (non-default) views it will probably be easier to
delete them and just start over than to try to find all the places where the
plugins and handlers need to be altered. Start with the new default
calendar (after reverting it so any previous changes have been
Expand All @@ -38,7 +38,7 @@ removed). Then clone it and make the following changes:
- If you have the iCal module enabled, click on the iCal display. Edit the
Row plugin settings and select the date field you want to use in the iCal feed.

After you have made these changes, go to the Views Tools tab and clear the Views
After you have made these changes, go to the Views Tools tab and clear the Views
caches. Also go to admin/config/regional/settings, make sure the right
first day of the week is selected, and resubmit that page even if you
don't make any changes. That step is to fix a bug that might have set that date
Expand Down
5 changes: 3 additions & 2 deletions profiles/openoutreach/modules/contrib/calendar/calendar.info
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ files[] = calendar.module
files[] = includes/calendar.views.inc
files[] = includes/calendar_plugin_style.inc
files[] = includes/calendar_plugin_row_node.inc
files[] = includes/calendar_plugin_row.inc
files[] = theme/theme.inc
files[] = theme/calendar-style.tpl.php
files[] = theme/calendar-row-node.tpl.php

; Information added by drupal.org packaging script on 2011-11-19
; Information added by drupal.org packaging script on 2012-01-04
version = "7.x-3.x-dev"
core = "7.x"
project = "calendar"
datestamp = "1321704196"
datestamp = "1325678740"

149 changes: 139 additions & 10 deletions profiles/openoutreach/modules/contrib/calendar/calendar.module
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,69 @@ define('CALENDAR_HIDE_ALL', -1);
* Adds calendar filtering and displays to Views.
*/

/**
* Implements hook_preprocess_date_views_pager().
*
* Creates a calendar_links array which is stored in the session and used
* in calendar_menu_local_tasks_alter() to display the links as action items and dynamic tabs.
* The links can be altered or deleted using hook_calendar_links_alter().
*
*/
function calendar_preprocess_date_views_pager(&$vars) {
$view = $vars['plugin']->view;
if ($view->plugin_name != 'calendar_style') {
return;
}
$options = $view->style_options;

// If we're not on a view with a path (a page), no links are needed.
$current_path = !empty($view->display_handler->options['path']) ? $view->display_handler->options['path'] : '';
if (empty($current_path)) {
return;
}

// Find all the displays in this view that use the calendar style and have a path and create links to each.
$calendar_links[$current_path] = array();
$base = array('attributes' => array('rel' => 'nofollow'));
foreach ($view->display as $id => $display) {
// Check for !empty() in case the view is not fully formed or has displays that are marked to be deleted.
if (!empty($display->deleted) || empty($display->display_options['style_plugin']) || (isset($display->display_options['enabled']) && $display->display_options['enabled'] == FALSE)) {
continue;
}
if ($display->display_options['style_plugin'] == 'calendar_style' && !empty($display->display_options['path'])) {
$path = $display->display_options['path'];
$title = $display->display_title;
$type = !empty($display->display_options['style_options']['calendar_type']) ? $display->display_options['style_options']['calendar_type'] : 'month';

// Make sure the links to other calendar displays use the right path for that display.
// Get rid of pager links when swapping between displays to force the base argument
// to be structured correctly for the type of display. This means you can't use
// these links in a block or panel.
$href = str_replace($current_path, $path, date_pager_url($view, $type, NULL, TRUE, FALSE));
$part_path = substr($href, strlen(base_path()));

// Once we have a path for the links to other displays, add it to our links array.
$calendar_links[$current_path]['tabs'][$type] = array('title' => $title, 'path' => $part_path);
$calendar_links[$current_path]['types'][] = $type;
}
}

// If an 'Add new ... link is provided, add it here.
if (!empty($view->date_info->calendar_date_link) && !empty($view->date_info->url)
&& (user_access("administer nodes") || user_access('create ' . $view->date_info->calendar_date_link . ' content'))) {
$name = node_type_get_name($view->date_info->calendar_date_link);
$href = 'node/add/' . str_replace('_', '-', $view->date_info->calendar_date_link);
$calendar_links[$current_path]['actions'][] = array('title' => t('Add @name', array('@name' => $name)), 'path' => $href);
}

// Pass this through drupal_alter() so it can be adjusted in custom code or in the theme.
drupal_alter('calendar_links', $calendar_links);

// Add the value to the session so it can be used to create the tabs.
$_SESSION['calendar_links'][$current_path] = $calendar_links[$current_path];

}

/**
* Implements hook_menu_local_tasks_alter().
*
Expand All @@ -30,7 +93,7 @@ function calendar_menu_local_tasks_alter(&$data, $router_item, $root_path) {
// redirect back to the calendar.
$item['localized_options'] += array('query' => array());
$item['localized_options']['query'] += drupal_get_destination();
if ($item['access']) {
if (array_key_exists('access', $item) && $item['access']) {
$data['actions']['output'][] = array(
'#theme' => 'menu_local_action',
'#link' => $item,
Expand All @@ -41,19 +104,20 @@ function calendar_menu_local_tasks_alter(&$data, $router_item, $root_path) {
if (!empty($calendar_data['tabs'])) {
$delta = !empty($data['tabs'][0]['count']) ? $data['tabs'][0]['count'] - 1 : 0;
foreach ($calendar_data['tabs'] as $tab) {
$item = menu_get_item($tab['path']);
$clean_path = str_replace('?q=', '', $tab['path']);
$item = menu_get_item($clean_path);
if (!empty($item)) {
$item['title'] = $tab['title'];
// If we have moved off the default page for the calendar, the
// links to the other views will have been adjusted to keep information
// about the right year/month/week/day to go to.
$item['href'] = $tab['path'];
if ($item['access']) {
$item['href'] = $clean_path;
if (array_key_exists('access', $item) && $item['access']) {
$data['tabs'][0]['output'][$delta] = array(
'#theme' => 'menu_local_task',
'#link' => $item,
);
if (strpos($tab['path'], $root_path) === 0) {
if (strpos($clean_path, $root_path) === 0) {
$data['tabs'][0]['output'][$delta]['#active'] = TRUE;
}
$delta++;
Expand All @@ -80,7 +144,7 @@ function calendar_views_api() {
* Calendar display types.
*/
function calendar_display_types() {
return array('year' => t('Year'), 'month' => t('Month'), 'day' => t('Day'), 'week' => t('Week'));
return array('year' => t('Year'), 'month' => t('Month'), 'day' => t('Day'), 'week' => t('Week'));
}

/**
Expand Down Expand Up @@ -128,11 +192,16 @@ function calendar_theme() {
'calendar_month_col' => $base + array(
'template' => 'calendar-month-col',
'variables' => array('item' => NULL),
),
),
'calendar_month_row' => $base + array(
'template' => 'calendar-month-row',
'variables' => array('inner' => NULL, 'class' => NULL, 'iehint' => NULL),
),
'calendar_month_multiple_entity' => $base + array(
'template' => 'calendar-month-multiple-entity',
'variables' => array('
curday' => NULL, 'count' => NULL, 'view' => NULL, 'ids' => NULL),
),
);
}

Expand All @@ -158,6 +227,66 @@ function calendar_node_view($node, $view_mode, $langcode) {
}
}

/**
* Helper function to link an entity type to a calendar.
*
* @param $entity_type - the type of entity.
* @param $bundle - the entity bundle name.
* @param $path - the calendar path to use for this bundle.
*/
function calendar_set_link($entity_type, $bundle, $path) {
switch ($entity_type) {
case 'node':
variable_set('calendar_date_link_' . $bundle, $path);
break;
default:
variable_set('calendar_date_link_' . $entity_type . '_' . $bundle, $path);
break;
}
}

/**
* Helper function to clear previously-set links to calendars.
*
* @param $bundle, Clear all links for this bundle. If NULL, clear all links.
*/
function calendar_clear_link_bundle($bundle = NULL) {
if (empty($bundle)) {
$result = db_select('variable', 'v')
->fields('v', 'name')
->condition('name', 'calendar_date_link_%', 'LIKE')
->execute()->fetchAll(PDO::FETCH_ASSOC);
}
else {
$result = db_select('variable', 'v')
->fields('v', 'name')
->condition('name', 'calendar_date_link_' . $bundle)
->execute()->fetchAll(PDO::FETCH_ASSOC);
}
// Iterate over all the values and delete them.
foreach ($result as $row) {
variable_del($row['name']);
}
}

/**
* Helper function to clear previously-set links to calendars.
*
* @param $path, Clear all links to this path. If NULL, clear all links.
*/
function calendar_clear_link_path($path = NULL) {
$result = db_select('variable', 'v')
->fields('v', array('name', 'value'))
->condition('name', 'calendar_date_link_%', 'LIKE')
->execute()->fetchAll(PDO::FETCH_ASSOC);
// Iterate over all the values and delete them.
foreach ($result as $row) {
if (empty($path) || unserialize($row['value']) == $path) {
variable_del($row['name']);
}
}
}

/**
* Formats the weekday information into table header format
*
Expand Down Expand Up @@ -255,9 +384,9 @@ function calendar_granularity_path(&$view, $granularity) {
$paths = &drupal_static(__FUNCTION__, array());
if (!array_key_exists($view->name, $paths) || !(array_key_exists($granularity, $paths[$view->name]))) {
$paths[$view->name][$granularity] = '';
foreach($view->display as $id => $display) {
foreach ($view->display as $id => $display) {
// Check for !empty() in case the view is not fully formed or has displays that are marked to be deleted
if (!empty($display->deleted) || empty($display->display_options['style_plugin'])) {
if (!empty($display->deleted) || empty($display->display_options['style_plugin']) || (isset($display->display_options['enabled']) && $display->display_options['enabled'] == FALSE)) {
continue;
}
if ($display->display_options['style_plugin'] == 'calendar_style' && !empty($display->display_options['path'])) {
Expand Down Expand Up @@ -296,7 +425,7 @@ function calendar_validate_hex_color($element, &$form_state) {
return;
}
if (!preg_match('/^#(?:(?:[a-f\d]{3}){1,2})$/i', $element['#value'])) {
form_error($element, "'". check_plain($element['#value']) ."'". t(' is not a valid hex color'));
form_error($element, t("'@color' is not a valid hex color", array('@color' => $element['#value'])));
}
else {
form_set_value($element, $element['#value'], $form_state);
Expand Down
Loading

0 comments on commit 88b4a49

Please sign in to comment.