Commit db02317f authored by Eric Bremner's avatar Eric Bremner
Browse files

FDSU-1851: Merging in beta release.

parents 2934dba0 7998b62a
......@@ -126,6 +126,36 @@ function uw_virtual_site_homepage_field_default_field_bases() {
'type' => 'text',
);
// Exported field_base: 'field_uw_home_page_banners'
$field_bases['field_uw_home_page_banners'] = array(
'active' => 1,
'cardinality' => 10,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_uw_home_page_banners',
'foreign keys' => array(
'fid' => array(
'columns' => array(
'fid' => 'fid',
),
'table' => 'file_managed',
),
),
'indexes' => array(
'fid' => array(
0 => 'fid',
),
),
'locked' => 0,
'module' => 'image',
'settings' => array(
'default_image' => 0,
'uri_scheme' => 'public',
),
'translatable' => 0,
'type' => 'image',
);
// Exported field_base: 'field_uw_office_hours'
$field_bases['field_uw_office_hours'] = array(
'active' => 1,
......@@ -270,5 +300,40 @@ function uw_virtual_site_homepage_field_default_field_bases() {
'type' => 'text_with_summary',
);
// Exported field_base: 'field_uw_theme_settings'
$field_bases['field_uw_theme_settings'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_uw_theme_settings',
'foreign keys' => array(),
'indexes' => array(
'value' => array(
0 => 'value',
),
),
'locked' => 0,
'module' => 'list',
'settings' => array(
'allowed_values' => array(
'default' => 'University of Waterloo',
'ahs' => 'Applied Health Science',
'arts' => 'Arts',
'engineering' => 'Engineering',
'environment' => 'Environment',
'math' => 'Math',
'science' => 'Science',
'cgc' => 'Conrad Grebel University College',
'ren' => 'Renison University College',
'stj' => 'St. Jerome\'s University',
'stp' => 'St. Paul\'s University College',
),
'allowed_values_function' => '',
),
'translatable' => 0,
'type' => 'list_text',
);
return $field_bases;
}
......@@ -290,6 +290,106 @@ function uw_virtual_site_homepage_field_default_field_instances() {
),
);
// Exported field_instance: 'node-uw_virtual_site_homepage-field_uw_home_page_banners'
$field_instances['node-uw_virtual_site_homepage-field_uw_home_page_banners'] = array(
'bundle' => 'uw_virtual_site_homepage',
'deleted' => 0,
'description' => 'Provide banner images for virtual site homepages on Scholar at Waterloo sites.',
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'image',
'settings' => array(
'image_link' => '',
'image_style' => '',
),
'type' => 'image',
'weight' => 11,
),
'links' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'no_image_teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'sidebar_teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'slide_teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'title' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'field_uw_home_page_banners',
'label' => 'Homepage banners',
'required' => 0,
'settings' => array(
'alt_field' => 1,
'alt_field_required' => 1,
'default_image' => 0,
'file_directory' => '',
'file_extensions' => 'png gif jpg jpeg',
'filefield_paths' => array(
'active_updating' => 0,
'file_name' => array(
'options' => array(
'pathauto' => 0,
'transliterate' => 0,
),
'value' => '[file:ffp-name-only-original].[file:ffp-extension-original]',
),
'file_path' => array(
'options' => array(
'pathauto' => 0,
'transliterate' => 0,
),
'value' => '',
),
'retroactive_update' => 0,
),
'max_filesize' => '',
'max_resolution' => '',
'min_resolution' => '',
'title_field' => 1,
'title_field_required' => 0,
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'image',
'settings' => array(
'preview_image_style' => 'thumbnail',
'progress_indicator' => 'throbber',
),
'type' => 'image_image',
'weight' => 1,
),
);
// Exported field_instance: 'node-uw_virtual_site_homepage-field_uw_office_hours'
$field_instances['node-uw_virtual_site_homepage-field_uw_office_hours'] = array(
'bundle' => 'uw_virtual_site_homepage',
......@@ -675,6 +775,77 @@ function uw_virtual_site_homepage_field_default_field_instances() {
),
);
// Exported field_instance: 'node-uw_virtual_site_homepage-field_uw_theme_settings'
$field_instances['node-uw_virtual_site_homepage-field_uw_theme_settings'] = array(
'bundle' => 'uw_virtual_site_homepage',
'default_value' => array(
0 => array(
'value' => 'default',
),
),
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'list',
'settings' => array(),
'type' => 'list_default',
'weight' => 11,
),
'links' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'no_image_teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'sidebar_teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'slide_teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'title' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'field_uw_theme_settings',
'label' => 'Theme settings',
'required' => 0,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'options',
'settings' => array(),
'type' => 'options_select',
'weight' => 1,
),
);
// Exported field_instance: 'node-uw_virtual_site_homepage-og_group_ref'
$field_instances['node-uw_virtual_site_homepage-og_group_ref'] = array(
'bundle' => 'uw_virtual_site_homepage',
......@@ -804,10 +975,13 @@ function uw_virtual_site_homepage_field_default_field_instances() {
'weight' => 0,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
'label' => 'hidden',
'module' => 'vsite_vocab',
'settings' => array(
'concatenate' => 1,
),
'type' => 'og_vocab',
'weight' => 10,
),
'title' => array(
'label' => 'above',
......@@ -845,13 +1019,16 @@ function uw_virtual_site_homepage_field_default_field_instances() {
t('Extension');
t('Faculty');
t('Groups audience');
t('Homepage banners');
t('Images should be 360 pixels by 480 pixels.');
t('OG vocabulary');
t('Office hours');
t('Office location');
t('Phone number');
t('Profile image');
t('Provide banner images for virtual site homepages on Scholar at Waterloo sites.');
t('Site description');
t('Theme settings');
return $field_instances;
}
name = UW Virtual Site Homepage
description = UW virtual site homepage settings
core = 7.x
package = Features
package = uWaterloo Content Types
project = uw_virtual_site_homepage
dependencies[] = ctools
dependencies[] = eim
dependencies[] = features
dependencies[] = image
dependencies[] = list
dependencies[] = media
dependencies[] = menu
dependencies[] = node
......@@ -25,20 +25,24 @@ features[field_base][] = field_uw_credentials
features[field_base][] = field_uw_email_homepage
features[field_base][] = field_uw_extension
features[field_base][] = field_uw_faculty
features[field_base][] = field_uw_home_page_banners
features[field_base][] = field_uw_office_hours
features[field_base][] = field_uw_office_location
features[field_base][] = field_uw_phone_number
features[field_base][] = field_uw_profile_image
features[field_base][] = field_uw_site_description
features[field_instance][] = node-uw_virtual_site_homepage-field_uw_credentials
features[field_base][] = field_uw_theme_settings
features[field_instance][] = node-uw_virtual_site_homepage-field_uw_email_homepage
features[field_instance][] = node-uw_virtual_site_homepage-field_uw_extension
features[field_instance][] = node-uw_virtual_site_homepage-field_uw_faculty
features[field_instance][] = node-uw_virtual_site_homepage-field_uw_home_page_banners
features[field_instance][] = node-uw_virtual_site_homepage-field_uw_office_hours
features[field_instance][] = node-uw_virtual_site_homepage-field_uw_office_location
features[field_instance][] = node-uw_virtual_site_homepage-field_uw_phone_number
features[field_instance][] = node-uw_virtual_site_homepage-field_uw_profile_image
features[field_instance][] = node-uw_virtual_site_homepage-field_uw_site_description
features[field_instance][] = node-uw_virtual_site_homepage-field_uw_theme_settings
features[field_instance][] = node-uw_virtual_site_homepage-og_group_ref
features[field_instance][] = node-uw_virtual_site_homepage-og_vocabulary
features[node][] = uw_virtual_site_homepage
......
......@@ -6,9 +6,110 @@
include_once 'uw_virtual_site_homepage.features.inc';
/*
* Implements hook_field_widget_form_alter().
* Adding process to image types to change title to caption for homepage banners.
*/
function uw_virtual_site_homepage_field_widget_form_alter(&$element, &$form_state, $context) {
if($context['field']['type'] == 'image') {
//dsm($context['field']['type']);
}
if($context['field']['type'] == 'image') {
foreach(element_children($element) as $key => $child) {
if($element[$key]['#description'] == 'Provide banner images for virtual site homepages on Scholar at Waterloo sites.') {
$element[$key]['#process'][] = 'uw_virtual_site_homepage_image_field_widget_process';
}
}
}
}
/**
* Implements hook_form_FORM_ID_alter().
* FORM_ID = uw_virtual_site_homepage_node_form (edit virtual site homepage).
* Implements hook_image_field_widget_process().
* Processing images to change title to caption for homepage banners.
*/
function uw_virtual_site_homepage_image_field_widget_process($element, &$form_state, $form) {
// Set the title to be the caption and the description.
$element['title']['#title'] = 'Caption';
$element['title']['#description'] = 'The caption is display with the picture.';
// Return the altered element
return $element;
}
/**
* Implements hook_page_alter().
* Placing homepage banners on the virtual site homepage.
*/
function uw_virtual_site_homepage_page_alter(&$page) {
// Setting the variables to be used in homepage banners.
$index = 0;
$continue = true;
// If there are banners, process them.
if(isset($page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index])) {
// html divs in homepage banners.
$html = '<div class="field-name-field-uw-home-page-banners">';
$html .= '<div class="field-items">';
// While there is a continue, process the homepage banners.
while($continue) {
// Set the image.
$html .= '<figure class="field-item uw-homepage-banners-figure">';
$html .= '<img src="' . file_uri_target($page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index]['#item']['uri']) . '">';
// If there is a title, double check, and then set the caption.
if(isset($page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index]['#item']['title'])) {
// If there is a title, set the caption.
if($page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index]['#item']['title'] !== "") {
$html .= '<span class="banner-caption">' . $page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index]['#item']['title'] . '</span>';
}
}
// More html.
$html .= '<div class="banner-controls">';
// Set previous and next buttons.
$html .= '<button id="previous_banner" class="tabs-previous"><</button>';
$html .= '<button id="next_banner" class="tabs-next">></button>';
// More html to close the homepage banners.
$html .= '</div>';
$html .= '</figure>';
// Increment the index.
$index++;
// If there are not any more homepage banners, stop processing the homepage banners.
if(!(isset($page['uw-virtual-site-homepage']['field_uw_home_page_banners'][$index]))) {
$continue = false;
}
}
// Final closing html and play/pause button.
$html .= '</div>';
$html .= '<button class="slideshow-control pause" title="Pause">';
$html .= '<span class="element-invisible">Pause banner slideshow</span>';
$html .= '<span class="icon-pause"></span>';
$html .= '</button>';
$html .= '</div>';
// Set the html to the page variable.
$page['uw_virtual_page_homepage_banners_html'] = $html;
}
// If there is credentials in the virutal site homepage settings, add it to the header.
if(isset($page['uw-virtual-site-homepage']['field_uw_credentials'])) {
$page['header_second']['boxes_site_info']['content']['#markup'] = preg_replace('/<p>(.*)<a(.*)<\/a>/s', '<h2>' . $page['uw-virtual-site-homepage']['field_uw_credentials'][0]['#markup'] . '</h2>', $page['header_second']['boxes_site_info']['content']['#markup']);
}
}
/**
* Implements hook_FORMID_form_alter().
* Removing options and placing data on the form for setting the virtual homepage.
*/
function uw_virtual_site_homepage_form_uw_virtual_site_homepage_node_form_alter(&$form, &$form_state, $form_id) {
global $base_path;
......@@ -110,18 +211,6 @@ function uw_virtual_site_homepage_button_validate(&$form, &$form_state) {
drupal_add_css(drupal_get_path('module', 'uw_virtual_site_homepage') . '/css/uw_virtual_site_homepage.css');
}
/**
* Implements hook_page_alter().
* Add credentials to header if present.
*/
function uw_virtual_site_homepage_page_alter(&$page) {
// If there is credentials in the virutal site homepage settings, add it to the header.
if(isset($page['uw-virtual-site-homepage']['field_uw_credentials'])) {
$page['header_second']['boxes_site_info']['content']['#markup'] = preg_replace('/<p>(.*)<a(.*)<\/a>/s', '<h2>' . $page['uw-virtual-site-homepage']['field_uw_credentials'][0]['#markup'] . '</h2>', $page['header_second']['boxes_site_info']['content']['#markup']);
}
}
/**
* Submit callback.
* Saves site title and site description.
......
Supports Markdown
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