From 29dfcfbed57a6627be00c8f2a1ee7b0356c94adb Mon Sep 17 00:00:00 2001
From: Chris Gross <gross.364@osu.edu>
Date: Wed, 3 Feb 2016 19:26:14 -0500
Subject: [PATCH] daily build

---
 profiles/wcm_base/CHANGELOG.txt               |  4 ++-
 ...ocio_media.features.features_overrides.inc |  9 ++++++
 .../custom/ocio_media/ocio_media.features.inc |  9 ++++++
 .../modules/custom/ocio_media/ocio_media.info | 11 ++++++-
 .../custom/ocio_media/ocio_media.module       | 23 ++++++++++++++
 .../ocio_media/ocio_media.strongarm.inc       |  2 +-
 .../wcm_user_config/theme/user-login.tpl.php  |  4 +--
 .../wcm_user_config/wcm_user_config.module    | 30 ++++++++++++++++++-
 8 files changed, 86 insertions(+), 6 deletions(-)

diff --git a/profiles/wcm_base/CHANGELOG.txt b/profiles/wcm_base/CHANGELOG.txt
index 0cd11f62..284bbf81 100644
--- a/profiles/wcm_base/CHANGELOG.txt
+++ b/profiles/wcm_base/CHANGELOG.txt
@@ -1,5 +1,7 @@
-WCM Base 7.x-1.x, 2016-02-02
+WCM Base 7.x-1.x, 2016-02-03
 -----------------------------
+- OCIO Media: Added support for .dwg and .zip files.
+- WCM User Config: Return to destination URL after Shibboleth login redirect.
 - WCM Base:
   - Added r4032login module, redirects Access Denied requests to login page.
   - Added Chosen module, allowing read-only jQuery multiselect field formats.
diff --git a/profiles/wcm_base/modules/custom/ocio_media/ocio_media.features.features_overrides.inc b/profiles/wcm_base/modules/custom/ocio_media/ocio_media.features.features_overrides.inc
index 1ebba59c..49a5a228 100644
--- a/profiles/wcm_base/modules/custom/ocio_media/ocio_media.features.features_overrides.inc
+++ b/profiles/wcm_base/modules/custom/ocio_media/ocio_media.features.features_overrides.inc
@@ -36,6 +36,15 @@ function ocio_media_features_override_default_overrides() {
   // Exported overrides for: file_type
   $overrides["file_type.audio.disabled"] = FALSE;
   $overrides["file_type.document.disabled"] = FALSE;
+  $overrides["file_type.document.mimetypes|10"] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
+  $overrides["file_type.document.mimetypes|11"] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
+  $overrides["file_type.document.mimetypes|12"] = 'application/acad';
+  $overrides["file_type.document.mimetypes|4"] = 'application/zip';
+  $overrides["file_type.document.mimetypes|5"] = 'application/vnd.ms-powerpoint';
+  $overrides["file_type.document.mimetypes|6"] = 'application/vnd.oasis.opendocument.text';
+  $overrides["file_type.document.mimetypes|7"] = 'application/vnd.oasis.opendocument.spreadsheet';
+  $overrides["file_type.document.mimetypes|8"] = 'application/vnd.oasis.opendocument.presentation';
+  $overrides["file_type.document.mimetypes|9"] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
   $overrides["file_type.image.disabled"] = FALSE;
   $overrides["file_type.video.disabled"] = FALSE;
 
diff --git a/profiles/wcm_base/modules/custom/ocio_media/ocio_media.features.inc b/profiles/wcm_base/modules/custom/ocio_media/ocio_media.features.inc
index c8518a9b..19f8a8be 100644
--- a/profiles/wcm_base/modules/custom/ocio_media/ocio_media.features.inc
+++ b/profiles/wcm_base/modules/custom/ocio_media/ocio_media.features.inc
@@ -82,6 +82,15 @@ function ocio_media_file_default_types_alter(&$data) {
   }
   if (isset($data['document'])) {
     $data['document']->disabled = FALSE; /* WAS: '' */
+    $data['document']->mimetypes[10] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; /* WAS: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' */
+    $data['document']->mimetypes[11] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; /* WAS: '' */
+    $data['document']->mimetypes[12] = 'application/acad'; /* WAS: '' */
+    $data['document']->mimetypes[4] = 'application/zip'; /* WAS: 'application/vnd.ms-powerpoint' */
+    $data['document']->mimetypes[5] = 'application/vnd.ms-powerpoint'; /* WAS: 'application/vnd.oasis.opendocument.text' */
+    $data['document']->mimetypes[6] = 'application/vnd.oasis.opendocument.text'; /* WAS: 'application/vnd.oasis.opendocument.spreadsheet' */
+    $data['document']->mimetypes[7] = 'application/vnd.oasis.opendocument.spreadsheet'; /* WAS: 'application/vnd.oasis.opendocument.presentation' */
+    $data['document']->mimetypes[8] = 'application/vnd.oasis.opendocument.presentation'; /* WAS: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' */
+    $data['document']->mimetypes[9] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; /* WAS: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' */
   }
   if (isset($data['image'])) {
     $data['image']->disabled = FALSE; /* WAS: '' */
diff --git a/profiles/wcm_base/modules/custom/ocio_media/ocio_media.info b/profiles/wcm_base/modules/custom/ocio_media/ocio_media.info
index 9ec7cec4..675ab38f 100644
--- a/profiles/wcm_base/modules/custom/ocio_media/ocio_media.info
+++ b/profiles/wcm_base/modules/custom/ocio_media/ocio_media.info
@@ -1,5 +1,5 @@
 name = OCIO Media
-description = Media settings for OCIOpoly sites
+description = Media settings for WCM sites
 core = 7.x
 package = OCIO Configuration
 version = 7.x-1.0
@@ -70,6 +70,15 @@ features[features_overrides][] = file_display.video__preview__media_youtube_imag
 features[features_overrides][] = file_display.video__preview__media_youtube_image.weight
 features[features_overrides][] = file_type.audio.disabled
 features[features_overrides][] = file_type.document.disabled
+features[features_overrides][] = file_type.document.mimetypes|10
+features[features_overrides][] = file_type.document.mimetypes|11
+features[features_overrides][] = file_type.document.mimetypes|12
+features[features_overrides][] = file_type.document.mimetypes|4
+features[features_overrides][] = file_type.document.mimetypes|5
+features[features_overrides][] = file_type.document.mimetypes|6
+features[features_overrides][] = file_type.document.mimetypes|7
+features[features_overrides][] = file_type.document.mimetypes|8
+features[features_overrides][] = file_type.document.mimetypes|9
 features[features_overrides][] = file_type.image.disabled
 features[features_overrides][] = file_type.video.disabled
 features[features_overrides][] = views_view.media_default.display|default|display_options|filters|field_file_tags_tid
diff --git a/profiles/wcm_base/modules/custom/ocio_media/ocio_media.module b/profiles/wcm_base/modules/custom/ocio_media/ocio_media.module
index 0a6eb1f1..22a45034 100644
--- a/profiles/wcm_base/modules/custom/ocio_media/ocio_media.module
+++ b/profiles/wcm_base/modules/custom/ocio_media/ocio_media.module
@@ -65,3 +65,26 @@ function ocio_media_form_alter(&$form, &$form_state, $form_id) {
     }
   }
 }
+
+/**
+ * Implements hook_file_mimetype_mapping_alter().
+ */
+function ocio_media_file_mimetype_mapping_alter(&$mapping) {
+
+  // Add support for dwg.
+  $new_mappings['dwg'] = 'application/acad';
+
+  foreach ($new_mappings as $extension => $mime_type) {
+    if (!in_array($mime_type, $mapping['mimetypes'])) {
+      // If the mime type does not already exist, add it.
+      $mapping['mimetypes'][] = $mime_type;
+    }
+
+    // Get the index of the mime type and assign the extension to that key.
+    $index = array_search($mime_type, $mapping['mimetypes']);
+    $mapping['extensions'][$extension] = $index;
+  }
+}
+
+
+
diff --git a/profiles/wcm_base/modules/custom/ocio_media/ocio_media.strongarm.inc b/profiles/wcm_base/modules/custom/ocio_media/ocio_media.strongarm.inc
index 69b301ed..d693b95e 100644
--- a/profiles/wcm_base/modules/custom/ocio_media/ocio_media.strongarm.inc
+++ b/profiles/wcm_base/modules/custom/ocio_media/ocio_media.strongarm.inc
@@ -321,7 +321,7 @@ function ocio_media_strongarm() {
   $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
   $strongarm->api_version = 1;
   $strongarm->name = 'file_entity_default_allowed_extensions';
-  $strongarm->value = 'jpg jpeg gif png txt doc docx xls xlsx pdf ppt pptx pps ppsx odt ods odp';
+  $strongarm->value = 'jpg jpeg gif png txt doc docx xls xlsx pdf ppt pptx pps ppsx odt ods odp zip dwg';
   $export['file_entity_default_allowed_extensions'] = $strongarm;
 
   $strongarm = new stdClass();
diff --git a/profiles/wcm_base/modules/custom/wcm_user_config/theme/user-login.tpl.php b/profiles/wcm_base/modules/custom/wcm_user_config/theme/user-login.tpl.php
index 053d285d..1d0ee685 100644
--- a/profiles/wcm_base/modules/custom/wcm_user_config/theme/user-login.tpl.php
+++ b/profiles/wcm_base/modules/custom/wcm_user_config/theme/user-login.tpl.php
@@ -1,7 +1,7 @@
 <div class="login-box">
   <h2>OSU Users</h2>
-  <p><a href="/saml_login">Log in with your OSU credentials</a></p>
-</div>
+  <p><a href="<?php print $https_base_url; ?>/saml_login<?php if ($has_destination) : ?>?ReturnTo=<?php print $return_to; ?><?php endif; ?>">Log in with your OSU credentials</a></p>
+  </div>
 
 <div class="login-box">
   <h2>Non-OSU Users</h2>
diff --git a/profiles/wcm_base/modules/custom/wcm_user_config/wcm_user_config.module b/profiles/wcm_base/modules/custom/wcm_user_config/wcm_user_config.module
index 1408b720..126be619 100644
--- a/profiles/wcm_base/modules/custom/wcm_user_config/wcm_user_config.module
+++ b/profiles/wcm_base/modules/custom/wcm_user_config/wcm_user_config.module
@@ -86,7 +86,6 @@ function wcm_user_config_theme($existing, $type, $theme, $path) {
   return $items;
 }
 
-
 /**
  * Implements hook_preprocess_page().
  */
@@ -101,3 +100,32 @@ function wcm_user_config_preprocess_page(&$vars) {
     drupal_set_title('Log In');
   }
 }
+
+/**
+ * Implements hook_preprocess_user_login().
+ */
+function wcm_user_config_preprocess_user_login(&$variables) {
+  global $base_url;
+
+  $https_base_url = str_replace('http://', 'https://', $base_url);
+
+  $variables['https_base_url'] = $https_base_url;
+
+  /*
+    drupal_get_destination()
+
+    Return value:
+      An associative array containing the key:
+        destination: The path provided via the destination query string or, if not available, the current path.
+  */
+  $destination = drupal_get_destination();
+
+  $variables['destination'] = $destination['destination'];
+  $variables['has_destination'] = TRUE;
+
+  $variables['return_to'] = $https_base_url . '/' . $destination['destination'];
+
+  if ($variables['destination'] == current_path()) {
+    $variables['has_destination'] = FALSE;
+  }
+}
-- 
GitLab