From e7d6f9cc60d5964a6e875ae9f6a67aabf14ca670 Mon Sep 17 00:00:00 2001
From: Andy Laken <drupal@laken.com>
Date: Thu, 3 Nov 2011 21:28:54 -0600
Subject: [PATCH] Issue 1331396: Make image size toggle UI configurable

---
 .../contentdm_viewer_image.module                  |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/modules/contentdm_viewer_image/contentdm_viewer_image.module b/modules/contentdm_viewer_image/contentdm_viewer_image.module
index 5a3bece..d0bb9d3 100644
--- a/modules/contentdm_viewer_image/contentdm_viewer_image.module
+++ b/modules/contentdm_viewer_image/contentdm_viewer_image.module
@@ -53,8 +53,16 @@ function contentdm_viewer_image_admin_settings() {
     '#size' => 4,
     '#default_value' => variable_get('contentdm_viewer_image_max_display_width', '800'),
     '#maxlength' => 4,
-    '#description' => t('If an image exceeds this width, it will be scaled down to be just less than this many pixels wide. If the original image exceeds this width, users will be presented with an option to display the full-sized image.'),
+    '#description' => t('If an image exceeds this width, it will be scaled down to be just less than this many pixels wide. If the original image exceeds this width, users will be presented with an option to display the full-sized image (if that option is selected below).'),
   );
+
+  $form['contentdm_viewer_allow_size_select'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Allow user to toggle between scaled and full-size image'),
+    '#default_value' => variable_get('contentdm_viewer_allow_size_select', 1),
+    '#description' => t("Disable to prevent users from downloading full-resolution images."),
+  );
+
   $form['contentdm_viewer_image_file_css'] = array(
     '#title' => t('CSS attributes for file div'),
     '#type' => 'textfield',
@@ -192,6 +200,9 @@ function theme_contentdm_image_item_viewer($node, $file_only = NULL) {
 }
 
 function contentdm_image_item_viewer_sizer_links($view_size) {
+  if (!variable_get('contentdm_viewer_allow_size_select', 1)) {
+    return;
+  }
   $output = '';
   $current_path = $_GET['q'];
   if ($view_size == 'fit') {
-- 
1.7.6.1

