Commit d988db2c authored by Liam Morland's avatar Liam Morland
Browse files

Coding standards

parent 320cb5b0
......@@ -204,18 +204,6 @@ a.individual-event-ical {
font-size: 1.1em;
}
/* Events by date, Events by audience and Events by type*/
#site-sidebar .block-events h2,
#block-views-event-type-block-events-by-type h2,
#block-views-events-with-calendar-block-1 h2,
#block-views-events-with-calendar-block-1 h3.full-archive {
/*background: url('images/menu-expanded.png') no-repeat 0px center;
padding-left: 10.5px;
cursor: pointer;*/
}
#site-sidebar h2.closed,
#site-sidebar h3.full-archive.closed {
/*background: url('images/menu-collapsed.png') no-repeat 0px center;*/
}
#site-sidebar h3.full-archive.closed {
margin-bottom: 1em;
}
......
......@@ -2,6 +2,7 @@
/**
* @file
* Exported View.
*/
$view = new view();
......@@ -130,7 +131,6 @@ $handler->display->display_options['filters']['type']['value'] = array(
$handler = $view->new_display('block', 'Block - News by Audience', 'block');
/* ---------------------------- */
......
......@@ -12,11 +12,12 @@
* - $block->region: The block region embedding the current block.
* - $classes: String of classes that can be used to style contextually through
* CSS. It can be manipulated through the variable $classes_array from
* preprocess functions. The default values can be one or more of the following:
* preprocess functions. The default values can be one or more of the
* following:
* - block: The current template type, i.e., "theming hook".
* - block-[module]: The module generating the block. For example, the user module
* is responsible for handling the default user navigation block. In that case
* the class would be "block-user".
* - block-[module]: The module generating the block. For example, the user
* module is responsible for handling the default user navigation block. In
* that case the class would be "block-user".
* - $title_prefix (array): An array containing additional output populated by
* modules, intended to be displayed in front of the main title tag that
* appears in the template.
......
......@@ -12,11 +12,12 @@
* - $block->region: The block region embedding the current block.
* - $classes: String of classes that can be used to style contextually through
* CSS. It can be manipulated through the variable $classes_array from
* preprocess functions. The default values can be one or more of the following:
* preprocess functions. The default values can be one or more of the
* following:
* - block: The current template type, i.e., "theming hook".
* - block-[module]: The module generating the block. For example, the user module
* is responsible for handling the default user navigation block. In that case
* the class would be "block-user".
* - block-[module]: The module generating the block. For example, the user
* module is responsible for handling the default user navigation block. In
* that case the class would be "block-user".
* - $title_prefix (array): An array containing additional output populated by
* modules, intended to be displayed in front of the main title tag that
* appears in the template.
......
......@@ -5,7 +5,8 @@
* Template to display the date box in a calendar.
*
* - $view: The view.
* - $granularity: The type of calendar this box is in -- year, month, day, or week.
* - $granularity: The type of calendar this box is in -- year, month, day, or
* week.
* - $mini: Whether or not this is a mini calendar.
* - $class: The class for this box -- mini-on, mini-off, or day.
* - $day: The day of the month.
......
......@@ -9,11 +9,14 @@
* $day_names: An array of the day of week names for the table header.
* $rows: An array of data for each day of the week.
* $view: The view.
* $min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
* $max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
* $min_date_formatted: The minimum date for this calendar in the format
* YYYY-MM-DD HH:MM:SS.
* $max_date_formatted: The maximum date for this calendar in the format
* YYYY-MM-DD HH:MM:SS.
*
* $show_title: If the title should be displayed. Normally false since the title is incorporated
* into the navigation, but sometimes needed, like in the year view of mini calendars.
* $show_title: If the title should be displayed. Normally false since the title
* is incorporated into the navigation, but sometimes needed, like in the year
* view of mini calendars.
*/
$params = array(
......@@ -28,23 +31,27 @@ $query = drupal_get_query_parameters();
$start_date = !empty($query['mini']) ? $query['mini'] : date('Y-m', strtotime($min_date_formatted));
if ($start_date != date('Y-m')) {
$path = current_path();
// Calendar starts mishaving somewhere in the 3000s so we don't support the 30th century onward; sorry, future-dwellers.
// Calendar starts mishaving somewhere in the 3000s so we don't support the
// 30th century onward; sorry, future-dwellers.
if (!empty($query['mini']) && preg_match('/^([12][0-9]{3}-(?:0[1-9]|1[012]|[2-9]|1(?![012]))).+/', $query['mini'], $matches)) {
// Starts with a valid date, but has to many characters; likely for a specific day, and we only want this to the month level.
// Starts with a valid date, but has to many characters; likely for a
// specific day, and we only want this to the month level.
$query['mini'] = date('Y-m', strtotime($matches[1]));
drupal_set_message(t('Invalid mini-calendar request. You have been redirected to display the closest match.'), 'warning');
drupal_goto($path, array('query' => $query));
}
elseif (!empty($query['mini']) && !preg_match('/^[12][0-9]{3}-(0?[1-9]|1[0-2])$/', $query['mini']) || !$start_date) {
// Invalid date format, go to current month.
// Do this instead of unsetting $query['mini'] so that this will still work on big calendar pages not in the current month.
// Do this instead of unsetting $query['mini'] so that this will still work
// on big calendar pages not in the current month.
$query['mini'] = date('Y-m');
drupal_set_message(t('Invalid mini-calendar request. You have been redirected to display the current month.'), 'warning');
drupal_goto($path, array('query' => $query));
}
else {
// everything's fine with the date, we just aren't in the current month, so need a link to go back.
// Do this instead of unsetting $query['mini'] so that this will still work on big calendar pages not in the current month.
// everything's fine with the date, we just aren't in the current month, so
// need a link to go back. Do this instead of unsetting $query['mini'] so
// that this will still work on big calendar pages not in the current month.
$query['mini'] = date('Y-m');
$return = l(t('Return to current month'), $path, array('query' => $query));
}
......
......@@ -30,7 +30,8 @@
* The view object for this navigation.
*
* $pager_prefix
* Additional information that might be added by overriding template_process_date_views_pager().
* Additional information that might be added by overriding
* template_process_date_views_pager().
*
* $extra_classes
* Extra classes for the wrapper, if any.
......
......@@ -41,7 +41,7 @@ function uw_ct_event_context_default_contexts() {
// Translatables
// Included for use with string extractors like potx.
t('Content');
t('Displays event block on a site\'s front page.');
t("Displays event block on a site's front page.");
$export['event-front_page'] = $context;
$context = new stdClass();
......
<?php
/**
* @file
* uw_ct_event.features.field_instance.inc
......
<?php
/**
* @file
* uw_ct_event.features.user_permission.inc
......
......@@ -162,4 +162,3 @@ features_exclude[field][node-uw_event-field_image] = node-uw_event-field_image
features_exclude[field_base][field_event_affiliation] = field_event_affiliation
features_exclude[field_instance][node-uw_event-field_event_affiliation] = node-uw_event-field_event_affiliation
features_exclude[taxonomy][uw_event_affiliation] = uw_event_affiliation
......@@ -2,14 +2,15 @@
/**
* @file
* Install, update, uninstall, disable and enable functions for the uw_ct_event module.
* Install, update, uninstall, disable, and enable functions.
*/
/**
* Implements hook_disable().
*
* Disable the event content type so that new nodes of this type can't be created
* and the related views are removed from view UI while this feature is disabled.
* Disable the event content type so that new nodes of this type can't be
* created and the related views are removed from view UI while this feature is
* disabled.
*/
function uw_ct_event_disable() {
watchdog('uw_ct_event', 'disable function executing');
......@@ -30,7 +31,8 @@ function uw_ct_event_disable() {
views_invalidate_cache();
}
// Remove Events tags menu link under Vocabularies when uw_ct_event module is disabled.
// Remove Events tags menu link under Vocabularies when uw_ct_event module is
// disabled.
$links = FALSE;
$links = menu_load_links('menu-site-manager-vocabularies');
$mild = FALSE;
......@@ -126,8 +128,9 @@ function uw_ct_event_install() {
$uw_event_types_vocabulary = (object) $edit;
}
else {
// TODO: Display a warning if the vocabulary exists
// TODO: Determine behaviour, overwrite existing vocab, abort, or use existing.
// @todo: Display a warning if the vocabulary exists
// @todo: Determine behaviour, overwrite existing vocab, abort, or use
// existing.
watchdog('uw_ct_event', 'Vocabulary already exists');
$uw_event_types_vocabulary = taxonomy_vocabulary_machine_name_load('uw_event_type');
}
......@@ -266,15 +269,18 @@ function uw_ct_event_install() {
watchdog('uw_ct_event', 'term Workshop already exists');
// Kris Notes: Sept. 1, 2011
// While this is set with strongarm, if the variable is not added to the database many errors are generated
// Issue occurs in workbench_moderation.module line 878
// if (in_array('revision', $options) && in_array('moderation', $options)) initially evaluates as false.
// This prevents the workbench moderation array from being added to the node object, and everything falls apart.
// Do one variable_set for every content type using workbench moderation.
// While this is set with strongarm, if the variable is not added to the
// database many errors are generated. Issue occurs in
// workbench_moderation.module line 878
// if (in_array('revision', $options) && in_array('moderation', $options))
// initially evaluates as false. This prevents the workbench moderation array
// from being added to the node object, and everything falls apart. Do one
// variable_set for every content type using workbench moderation.
variable_set('node_options_uw_event', array(0 => 'moderation', 1 => 'revision'));
// Disable the responsive view for events if the uw_cfg_responsive module isn't enabled and
// turn off the standard view and enable the responsive view if uw_cfg_responsive is enabled.
// Disable the responsive view for events if the uw_cfg_responsive module
// isn't enabled and turn off the standard view and enable the responsive view
// if uw_cfg_responsive is enabled.
watchdog('uw_ct_event', 'enable responsive views function executing');
// Read in any existing disabled views.
$views_status = variable_get('views_defaults', array());
......@@ -387,6 +393,8 @@ function uw_ct_event_update_7103() {
}
/**
* Disable events responsive view if the theme isn't the responsive theme.
*
* Repeating update 7103. We found that the install hook was being trumped by
* the enable hook (which did not have the code to disable non-responsive views
* so sites were having both the responsive and non-responsive views enabled.
......
......@@ -524,7 +524,7 @@ function uw_ct_event_block_view($delta = '') {
$events->leftJoin('field_data_field_event_date', 'events', 'events.entity_id = n.nid');
$events->fields('events', [
'field_event_date_value',
'field_event_date_value2'
'field_event_date_value2',
]);
$events->fields('n', ['nid', 'title', 'sticky']);
$events->condition('n.type', 'uw_event', '=');
......@@ -562,7 +562,7 @@ function uw_ct_event_block_view($delta = '') {
$date_formatted = format_date($date_start, 'custom', t('M', [], ['context' => 'php date format']))
. '&nbsp;'
. format_date($date_start, 'custom', t('j', [], ['context' => 'php date format']))
. '&nbsp;' . t('to') . '&nbsp;'
. t('&nbsp;to&nbsp;')
. format_date($date_end, 'custom', t('j, Y', [], ['context' => 'php date format']));
}
}
......@@ -581,7 +581,7 @@ function uw_ct_event_block_view($delta = '') {
$date_formatted = format_date($date_start, 'custom', t('M', [], ['context' => 'php date format']))
. '&nbsp;'
. format_date($date_start, 'custom', t('j', [], ['context' => 'php date format']))
. '&nbsp;' . t('to') . '&nbsp;'
. t('&nbsp;to&nbsp;')
. format_date($date_end, 'custom', t('M j, Y', [], ['context' => 'php date format']));
}
}
......@@ -593,7 +593,7 @@ function uw_ct_event_block_view($delta = '') {
}
else {
$date_formatted = format_date($date_start, 'custom', t('M j, Y', [], ['context' => 'php date format']))
. '&nbsp;' . t('to') . '&nbsp;'
. t('&nbsp;to&nbsp;')
. format_date($date_end, 'custom', t('M j, Y', [], ['context' => 'php date format']));
}
}
......@@ -881,7 +881,8 @@ function uw_ct_event_page_build() {
$breadcrumb[3] = l($month_name, 'events/archive/' . $year . '-' . $month_number);
drupal_set_breadcrumb($breadcrumb);
// Add element-invisible to leaflet-container when there is no latitude and longitude.
// Add element-invisible to leaflet-container when there is no
// latitude and longitude.
if ($node->field_event_location[LANGUAGE_NONE][0]['latitude'] == '0.000000' && $node->field_event_location[LANGUAGE_NONE][0]['longitude'] == '0.000000') {
drupal_add_js(drupal_get_path('module', 'uw_ct_event') . '/js/leaflet-map-invisible.js');
}
......
<?php
/**
* @file
* uw_ct_event.strongarm.inc
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment