Splitting this off from #609772: Impossible to extend the FileTransfer class system in contrib since that's already a monster patch just trying to fix the contrib extendability problem.

This issue is for the major UI bugs at authorize.php:

A) The form is utterly broken with JS disabled. As in, impossible to use.

B) We don't want the outer "FTP Connection settings" fieldsets. Those are pointless, and making Bojhan and Dries weep over at #613912: Move host and port into a collapsed "Advanced settings" fieldset on the authorize.php connection settings forms

I'll try to fix these ASAP, but #609772: Impossible to extend the FileTransfer class system in contrib is my current priority... (B) is a pretty trivial fix. (A) is more complicated. But, none of *this* stuff actually requires any knowledge of the guts of authorize.php, FileTransfer classes, etc, etc. Anyone with some good FormAPI and JS fu should be able to work on this if someone else wants to assign themselves. ;)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dww’s picture

From what I understand of the intention of the no-JS UI, authorize.php would be a multi-step form by default, where the first page just has the connection type select box and a "Enter connection settings" continue button. 2nd page would be the settings form for the backend selected on page 1. The continue button on page 2 would trigger whatever you're authorizing. In HEAD, the 1st page is properly hidden via CSS, so all you see is the drop down and the 1st button, but that tries to submit the full form which fails validation and you never see page 2 to provides your credentials.

There's currently JS that displays the right settings form based on what you select in the drop down, and it hides the 1st button and just gives you the 2nd on your first page, so you can submit the full form at once, pass validation, and proceed.

bfroehle’s picture

~Subscribing! :)

bfroehle’s picture

Maybe rather than trying to hack in a fix for this, we just simplify to the same mechanism the installer uses when selecting which database to use? (i.e., install_settings_form from includes/install.core.inc)

bfroehle’s picture

FileSize
162.05 KB

If you've never installed Drupal without JS enabled, a screenshot of the page is attached to this post.

dww’s picture

Yeah, that's the basic idea. We just need it to degrade at all. I don't care that much if it's a 2 page form or not. If it's easy to get the 2-page thing working as the code is currently trying to do, great. If not, I'm fine making it a single page that looks bad without JS. So long as it works at all, we're cool. But, we don't want separate fieldsets for each connection type if we can help it, since we don't want nested fieldsets by default.

bfroehle’s picture

Found the following errors in the form submission process:

  1. Function definition of authorize_filetransfer_form($form_state) is wrong. It should be authorize_filetransfer_form($form, &$form_state) instead.>
  2. Button #attributes class should be an array, not a string.
  3. authorize_filetransfer_form_validate checks the connection on all stages of form input, not just the final stage (after all connection information has been gathered).

Fixing these three problems results in a working non-JS interface.

Attached is a patch, and screenshots of the workflow in a non-JS client. (The final success page is not shown, as it is the same for a JS client). Workflow for JS client is unchanged.

Issues:

  1. "WARNING: You are not using an encrypted connection, so your password will be sent in plain text." sometimes appears twice, but I don't know how to fix this one. Using drupal_set_message is probably wrong.
  2. Button placement of "Change Connection Type" is ugly. (See attached screenshots).

Recommendation:
Commit this patch since it restores functionality for non-JS clients. Then downgrade to a normal bug and work out the remaining (visual) kinks.

bfroehle’s picture

Redid the warning message to be a form element instead of drupal_set_message:

-    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 warning">',
+      '#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>',
+    );

(The string was not changed).

Visually, the change is shown in the attached image.

bfroehle’s picture

webchick: I think this is ready to go... I've thoroughly tested it at this point on clients with both JS enabled and disabled.

Tor Arne Thune’s picture

FileSize
38.24 KB

Tried to install a module with this patch applied, with JS disabled in browser. It worked as explained. Also tried to install a module with JS enabled, and it worked like before. I could see nothing visibly broken.

It could use some cleanup, but at least now it's functional. Cleanup can be done later, in my opinion, as it would be great to have this in before release, to avoid unnecessary frustrations.

dww’s picture

Awesome, great work on this! I'm tempted to mark this "needs work" for the unnecessary nested fieldsets, which various UI folks said was a big problem and needed to be fixed before release. At one point, I tried just converting it to type markup, and using a div that the JS could target. That seemed to work, but I hadn't had time to get non-JS working so I didn't want to change it. But, I *think* it'd be really easy to do so again. I'll try to hop on IRC and coordinate with bfroehle to see if we can resolve this quickly. Stay tuned...

dww’s picture

Hrm, in IRC bfroehle claimed that converting this to #type container required him to change the JS, but in my testing that's not the case. Attached patch works fine with both JS and no-JS, as attached screenies demonstrate. If you change the connection type with JS enabled, it swaps out the other container for you and you get the SSH connection settings (which you can see if you open the advanced settings fieldset and see the default port switch back and forth).

I don't think we need the heading on the container which we had on the fieldset, since I believe it's self-evident given the "Connection method" selector. But if we want to maintain the heading even without the fieldset, it's easy to add a prefix on the containers -- we won't even break any strings. ;)

bfroehle’s picture

Status: Needs review » Reviewed & tested by the community

Works for me. :) I like the change from 'fieldset' to 'container'. Not so sure about losing the header text --- I think it's okay, the information is certainly there elsewhere.

There might be some complaints that changing from FTP to SSH erases the settings, but this is by-design. (Having the header text there made this change clearer, I think).

dww’s picture

Assigned: Unassigned » dww
Status: Reviewed & tested by the community » Needs work

Okay, I'll restore the header. We probably need the smallest possible UI change at this point.

dww’s picture

Okay, this restores the header. I also noticed that the warning about not having https was changed from an error style to a warning style in #7. To absolutely minimize UI changes at this point, I restored that as an error.

So, here's the (hopefully final) patch, a before screenie (note: no-JS is totally broken before, so the before screenie shows the JS case), and after screenies of both JS and no-JS.

bfroehle’s picture

Status: Needs review » Patch (to be ported)

Looks great :). Presenting the WARNING as an error is fine with me, and as dww pointed out, a previous issue.

I like keeping the header. It's not the prettiest at the moment, but I think it leaves the door open for further usability improvements since the string will be available.

bfroehle’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: +Update manager

OMG status mess up!

Edit: I did actually apply this patch and verify that installation procedure works for both JS enabled and disabled, and the screenshots presented by dww in #14 are correct as well.

Status: Patch (to be ported) » Needs work
Issue tags: -Update manager

The last submitted patch, 932846-14.fix-authorize-php-no-js-no-nested-fieldset.patch, failed testing.

bfroehle’s picture

Status: Reviewed & tested by the community » Needs review
bfroehle’s picture

Status: Needs review » Reviewed & tested by the community

Setting to RTBC -- the bot failed because

FAILED: [[SimpleTest]]: [MySQL] Setup environment: failed to clear checkout directory.
Bojhan’s picture

Looks good, this had UX sign off months ago - so get it in, I'd say

bfroehle’s picture

FileSize
19.19 KB

We're missing the most important screenshot of them all --- successfully installing a module when JS is disabled! :) Good work all!

bfroehle’s picture

Status: Needs work » Reviewed & tested by the community
+++ includes/authorize.inc	4 Jan 2011 00:19:19 -0000
@@ -184,6 +192,12 @@ function _authorize_filetransfer_connect
+  if($form_state['clicked_button']['#name'] != 'process_updates') {

Missing space after the if. Watch to see if it gets fixed in the actual commit...

Also, maybe should use '#limit_validation_errors' => array(), instead of the above, or change the '#submit' on some of the buttons. Or whatever, this will have to do for now.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 932846-14.fix-authorize-php-no-js-no-nested-fieldset.patch, failed testing.

dww’s picture

Stupid bot. This fixes the missing space. Let's see if we get lucky this time with our fragile, non-deterministic test environment...

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 932846-24.fix-authorize-php-no-js-no-nested-fieldset.patch, failed testing.

bfroehle’s picture

Status: Needs work » Reviewed & tested by the community

Test bot is borked.

webchick’s picture

dww’s picture

@webchick: the bot is now happy. ;)

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Awesome work. This is a really great issue to get crossed off the list before 7.0!

Committed to HEAD.

Status: Fixed » Closed (fixed)
Issue tags: -Update manager

Automatically closed -- issue fixed for 2 weeks with no activity.