From 7b5e9926a4d5d47b87a8d1259d485a2574ffb317 Mon Sep 17 00:00:00 2001
From: Jimmy Berry <jimmy@boombatower.com>
Date: Wed, 4 May 2011 00:39:44 -0500
Subject: Patch #1143650: UI for AWS SDK for PHP.

---
 ui/awssdk_ui.info   |    6 +++
 ui/awssdk_ui.module |   90 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+), 0 deletions(-)
 create mode 100644 ui/awssdk_ui.info
 create mode 100644 ui/awssdk_ui.module

diff --git a/ui/awssdk_ui.info b/ui/awssdk_ui.info
new file mode 100644
index 0000000..1f74300
--- /dev/null
+++ b/ui/awssdk_ui.info
@@ -0,0 +1,6 @@
+name = AWS SDK for PHP UI
+description = The AWS SDK for PHP configuration UI.
+package = Libraries
+core = 7.x
+configure = admin/config/media/awssdk
+dependencies[] = awssdk
diff --git a/ui/awssdk_ui.module b/ui/awssdk_ui.module
new file mode 100644
index 0000000..34e13bb
--- /dev/null
+++ b/ui/awssdk_ui.module
@@ -0,0 +1,90 @@
+<?php
+/**
+ * @file
+ * Provides primary Drupal hook implementations.
+ *
+ * @author Heshan Wanigasooriya ("heshan.lk", http://drupal.org/user/199102)
+ * @author Jimmy Berry ("boombatower", http://drupal.org/user/214218)
+ */
+
+/**
+ * Implements hook_menu().
+ */
+function awssdk_ui_menu() {
+  $items = array();
+
+  $items['admin/config/media/awssdk'] = array(
+    'title' => 'AWS SDK for PHP',
+    'description' => 'Configure the Amazon Web Services SDK settings.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('awssdk_ui_settings_form'),
+    'access arguments' => array('access administration pages'),
+  );
+
+  return $items;
+}
+
+/**
+ * Settings form.
+ */
+function awssdk_ui_settings_form($form, &$form_state) {
+  $form['aws_key'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Amazon Web Services Key'),
+    '#default_value' => variable_get('aws_key', ''),
+    '#required' => TRUE,
+    '#description' => t('Amazon Web Services Key. Found in the AWS Security Credentials.
+      You can also pass this value as the first parameter to a service constructor.'),
+  );
+  $form['aws_secret_key'] = array(
+    '#type' => 'password',
+    '#title' => t('Amazon Web Services Secret Key'),
+    '#default_value' => variable_get('aws_secret_key', ''),
+    '#required' => TRUE,
+    '#description' => t('Amazon Web Services Secret Key. Found in the AWS Security Credentials.
+      You can also pass this value as the second parameter to a service constructor.'),
+  );
+  $form['aws_account_id'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Your CanonicalUser ID'),
+    '#default_value' => variable_get('aws_account_id', ''),
+    '#description' => t('Your CanonicalUser ID. Used for setting access control settings in AmazonS3. Found in the AWS Security Credentials.'),
+  );
+  $form['aws_account_id'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Amazon Account ID without dashes'),
+    '#default_value' => variable_get('aws_account_id', ''),
+    '#description' => t('Amazon Account ID without dashes. Used for identification with Amazon EC2. Found in the AWS Security Credentials.'),
+  );
+  $form['aws_canonical_id'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Your CanonicalUser ID'),
+    '#default_value' => variable_get('aws_canonical_id', ''),
+    '#description' => t('Your CanonicalUser ID. Used for setting access control settings in AmazonS3. Found in the AWS Security Credentials.'),
+  );
+  $form['aws_mfa_serial'] = array(
+    '#type' => 'textfield',
+    '#title' => t('12-digit serial number'),
+    '#default_value' => variable_get('aws_mfa_serial', ''),
+    '#description' => t('12-digit serial number taken from the Gemalto device used for Multi-Factor Authentication. Ignore this if you\'re not using MFA.'),
+  );
+  $form['aws_cloudfront_keypair_id'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Amazon CloudFront key-pair to use for signing private URLs'),
+    '#default_value' => variable_get('aws_cloudfront_keypair_id', ''),
+    '#description' => t('Amazon CloudFront key-pair to use for signing private URLs. Found in the AWS Security Credentials. This can be set programmatically with <AmazonCloudFront::set_keypair_id()>.'),
+  );
+  $form['aws_cloudfront_private_key_pem'] = array(
+    '#type' => 'textfield',
+    '#title' => t('The contents of the *.pem private key that matches with the CloudFront key-pair ID'),
+    '#default_value' => variable_get('aws_cloudfront_private_key_pem', ''),
+    '#description' => t('The contents of the *.pem private key that matches with the CloudFront key-pair ID. Found in the AWS Security Credentials. This can be set programmatically with <AmazonCloudFront::set_private_key()>.'),
+  );
+  $form['aws_enable_extensions'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Set the value to true to enable autoloading for classes not prefixed with "Amazon" or "CF"'),
+    '#default_value' => variable_get('aws_enable_extensions', ''),
+    '#description' => t('Set the value to true to enable autoloading for classes not prefixed with "Amazon" or "CF". If enabled, load `sdk.class.php` last to avoid clobbering any other autoloaders.'),
+  );
+  return system_settings_form($form);
+}
-- 
1.7.4.2

