summaryrefslogtreecommitdiff
path: root/includes/authorize.inc
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2011-01-04 04:37:27 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2011-01-04 04:37:27 +0000
commit067a7f1e81671cdb2820b0a26ebc9a8681a9d8a7 (patch)
treed7dd7fb6d7a6be40bc4a54b1c39f8eb3b3f0c8bf /includes/authorize.inc
parent3a37a9c01bd3ffda42b3acc677637c1421dc56bc (diff)
downloadbrdo-067a7f1e81671cdb2820b0a26ebc9a8681a9d8a7.tar.gz
brdo-067a7f1e81671cdb2820b0a26ebc9a8681a9d8a7.tar.bz2
#932846 by bfroehle, dww: Fixed authorize.php connection settings form broken (doesn't degrade, pointless fieldset)
Diffstat (limited to 'includes/authorize.inc')
-rw-r--r--includes/authorize.inc26
1 files changed, 20 insertions, 6 deletions
diff --git a/includes/authorize.inc b/includes/authorize.inc
index 4baf2f152..a1e8a7bdb 100644
--- a/includes/authorize.inc
+++ b/includes/authorize.inc
@@ -9,7 +9,7 @@
/**
* Build the form for choosing a FileTransfer type and supplying credentials.
*/
-function authorize_filetransfer_form($form_state) {
+function authorize_filetransfer_form($form, &$form_state) {
global $base_url, $is_https;
$form = array();
@@ -28,7 +28,11 @@ function authorize_filetransfer_form($form_state) {
$available_backends = $_SESSION['authorize_filetransfer_info'];
if (!$is_https) {
- drupal_set_message(t('WARNING: You are not using an encrypted connection, so your password will be sent in plain text. <a href="@https-link">Learn more</a>.', array('@https-link' => 'http://drupal.org/https-information')), 'error');
+ $form['information']['https_warning'] = array(
+ '#prefix' => '<div class="messages error">',
+ '#markup' => t('WARNING: You are not using an encrypted connection, so your password will be sent in plain text. <a href="@https-link">Learn more</a>.', array('@https-link' => 'http://drupal.org/https-information')),
+ '#suffix' => '</div>',
+ );
}
// Decide on a default backend.
@@ -77,13 +81,17 @@ function authorize_filetransfer_form($form_state) {
'#attributes' => array('style' => 'display:none'),
);
- // Build a hidden fieldset for each one.
+ // Build a container for each connection type.
foreach ($available_backends as $name => $backend) {
$form['connection_settings']['authorize_filetransfer_default']['#options'][$name] = $backend['title'];
$form['connection_settings'][$name] = array(
- '#type' => 'fieldset',
+ '#type' => 'container',
'#attributes' => array('class' => array("filetransfer-$name", 'filetransfer')),
- '#title' => t('@backend connection settings', array('@backend' => $backend['title'])),
+ );
+ // We can't use #prefix on the container itself since then the header won't
+ // be hidden and shown when the containers are being manipulated via JS.
+ $form['connection_settings'][$name]['header'] = array(
+ '#markup' => '<h4>' . t('@backend connection settings', array('@backend' => $backend['title'])) . '</h4>',
);
$form['connection_settings'][$name] += _authorize_filetransfer_connection_settings($name);
@@ -111,7 +119,7 @@ function authorize_filetransfer_form($form_state) {
'#type' => 'submit',
'#value' => t('Change connection type'),
'#weight' => -5,
- '#attributes' => array('class' => 'filetransfer-change-connection-type'),
+ '#attributes' => array('class' => array('filetransfer-change-connection-type')),
);
}
// End non-JS code.
@@ -184,6 +192,12 @@ function _authorize_filetransfer_connection_settings_set_defaults(&$element, $ke
* @see authorize_filetransfer_form()
*/
function authorize_filetransfer_form_validate($form, &$form_state) {
+ // Only validate the form if we have collected all of the user input and are
+ // ready to proceed with updating or installing.
+ if ($form_state['clicked_button']['#name'] != 'process_updates') {
+ return;
+ }
+
if (isset($form_state['values']['connection_settings'])) {
$backend = $form_state['values']['connection_settings']['authorize_filetransfer_default'];
$filetransfer = authorize_get_filetransfer($backend, $form_state['values']['connection_settings'][$backend]);