<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[31949] trunk/src: Refine UI for FTP modal and shiny updates</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/31949">31949</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/31949","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>jorbin</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-04-01 02:47:55 +0000 (Wed, 01 Apr 2015)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Refine UI for FTP modal and shiny updates
Numerous changes to make the FTP modal experience a good one. These include:
* Update HTML used by both the form here and the form on the standalone screen
* Allow users to cancel FTP install
* Focus locking in the modal
* Focus on modal form on load
* ARIA Attributes
* Style Enhancements
* Add low screen height (such as phone and some tablets) friendly experience for entering credentials
Props ericlewis, afercia
Fixes <a href="https://core.trac.wordpress.org/ticket/31608">#31608</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincssformscss">trunk/src/wp-admin/css/forms.css</a></li>
<li><a href="#trunksrcwpadminincludesfilephp">trunk/src/wp-admin/includes/file.php</a></li>
<li><a href="#trunksrcwpadminjsupdatesjs">trunk/src/wp-admin/js/updates.js</a></li>
<li><a href="#trunksrcwpincludesscriptloaderphp">trunk/src/wp-includes/script-loader.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincssformscss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/css/forms.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/css/forms.css 2015-04-01 02:38:25 UTC (rev 31948)
+++ trunk/src/wp-admin/css/forms.css 2015-04-01 02:47:55 UTC (rev 31949)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -864,11 +864,58 @@
</span><span class="cx" style="display: block; padding: 0 10px"> margin: 25px;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.request-filesystem-credentials-dialog-content input[type="text"],
-.request-filesystem-credentials-dialog-content input[type="password"] {
- width: 85%;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.request-filesystem-credentials-form input[type="text"],
+.request-filesystem-credentials-form input[type="password"] {
+ display: block;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.request-filesystem-credentials-dialog input[type="text"],
+.request-filesystem-credentials-dialog input[type="password"] {
+ width: 100%;
+}
+
+.request-filesystem-credentials-form .field-title {
+ font-weight: 600;
+}
+
+.request-filesystem-credentials-dialog label[for="hostname"],
+.request-filesystem-credentials-dialog label[for="public_key"],
+.request-filesystem-credentials-dialog label[for="private_key"] {
+ display: block;
+ margin-bottom: 1em;
+}
+
+.request-filesystem-credentials-dialog .ftp-username,
+.request-filesystem-credentials-dialog .ftp-password {
+ float: left;
+ width: 48%;
+}
+
+.request-filesystem-credentials-dialog .ftp-password {
+ margin-left: 4%;
+}
+
+.request-filesystem-credentials-dialog .request-filesystem-credentials-action-buttons {
+ text-align: right;
+}
+
+.request-filesystem-credentials-dialog label[for="ftp"] {
+ margin-right: 10px;
+}
+
+#request-filesystem-credentials-dialog .button:not(:last-child) {
+ margin-right: 10px;
+}
+
+#request-filesystem-credentials-form .cancel-button {
+ display: none;
+}
+
+#request-filesystem-credentials-dialog .cancel-button {
+ display: inline;
+}
+
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /* =Media Queries
</span><span class="cx" style="display: block; padding: 0 10px"> -------------------------------------------------------------- */
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1098,8 +1145,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> max-width: 400px;
</span><span class="cx" style="display: block; padding: 0 10px"> width: auto;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+@media only screen and (max-height: 480px) {
+ /* Request Credentials */
+ .request-filesystem-credentials-dialog .notification-dialog{
+ width: 100%;
+ height: 100%;
+ position: fixed;
+ top: 0;
+ margin: 0;
+ left: 0;
+ overflow-y: auto;
+ }
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /* Smartphone */
</span><span class="cx" style="display: block; padding: 0 10px"> @media screen and (max-width: 600px) {
</span><span class="cx" style="display: block; padding: 0 10px"> /* Color Picker Options */
</span></span></pre></div>
<a id="trunksrcwpadminincludesfilephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/file.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/file.php 2015-04-01 02:38:25 UTC (rev 31948)
+++ trunk/src/wp-admin/includes/file.php 2015-04-01 02:47:55 UTC (rev 31949)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1125,9 +1125,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> -->
</span><span class="cx" style="display: block; padding: 0 10px"> </script>
</span><span class="cx" style="display: block; padding: 0 10px"> <form action="<?php echo esc_url( $form_post ) ?>" method="post">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<div>
-<h3><?php _e('Connection Information') ?></h3>
-<p><?php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<div id="request-filesystem-credentials-form" class="request-filesystem-credentials-form">
+<h3 id="request-filesystem-credentials-title"><?php _e( 'Connection Information' ) ?></h3>
+<p id="request-filesystem-credentials-desc"><?php
</ins><span class="cx" style="display: block; padding: 0 10px"> $label_user = __('Username');
</span><span class="cx" style="display: block; padding: 0 10px"> $label_pass = __('Password');
</span><span class="cx" style="display: block; padding: 0 10px"> _e('To perform the requested action, WordPress needs to access your web server.');
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1146,39 +1146,36 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> _e('If you do not remember your credentials, you should contact your web host.');
</span><span class="cx" style="display: block; padding: 0 10px"> ?></p>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<table class="form-table">
-<tr>
-<th scope="row"><label for="hostname"><?php _e('Hostname') ?></label></th>
-<td><input name="hostname" type="text" id="hostname" value="<?php echo esc_attr($hostname); if ( !empty($port) ) echo ":$port"; ?>"<?php disabled( defined('FTP_HOST') ); ?> size="40" /></td>
-</tr>
-
-<tr>
-<th scope="row"><label for="username"><?php echo $label_user; ?></label></th>
-<td><input name="username" type="text" id="username" value="<?php echo esc_attr($username) ?>"<?php disabled( defined('FTP_USER') ); ?> size="40" /></td>
-</tr>
-
-<tr>
-<th scope="row"><label for="password"><?php echo $label_pass; ?></label></th>
-<td><div><input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php disabled( defined('FTP_PASS') ); ?> size="40" /></div>
-<div><em><?php if ( ! defined('FTP_PASS') ) _e( 'This password will not be stored on the server.' ); ?></em></div></td>
-</tr>
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<label for="hostname">
+ <span class="field-title"><?php _e( 'Hostname' ) ?></span>
+ <input name="hostname" type="text" id="hostname" aria-describedby="request-filesystem-credentials-desc" class="code" placeholder="<?php esc_attr_e( __( 'example: www.mysite.com' ) ) ?>" value="<?php echo esc_attr($hostname); if ( !empty($port) ) echo ":$port"; ?>"<?php disabled( defined('FTP_HOST') ); ?> />
+</label>
+<div class="ftp-username">
+ <label for="username">
+ <span class="field-title"><?php echo $label_user; ?></span>
+ <input name="username" type="text" id="username" value="<?php echo esc_attr($username) ?>"<?php disabled( defined('FTP_USER') ); ?> />
+ </label>
+</div>
+<div class="ftp-password">
+ <label for="password">
+ <span class="field-title"><?php echo $label_pass; ?></span>
+ <input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php disabled( defined('FTP_PASS') ); ?> />
+ <em><?php if ( ! defined('FTP_PASS') ) _e( 'This password will not be stored on the server.' ); ?></em>
+ </label>
+</div>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php if ( isset($types['ssh']) ) : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<tr id="ssh_keys" style="<?php if ( 'ssh' != $connection_type ) echo 'display:none' ?>">
-<th scope="row"><?php _e('Authentication Keys') ?>
-<div class="key-labels textright">
-<label for="public_key"><?php _e('Public Key:') ?></label ><br />
-<label for="private_key"><?php _e('Private Key:') ?></label>
-</div></th>
-<td><br /><input name="public_key" type="text" id="public_key" value="<?php echo esc_attr($public_key) ?>"<?php disabled( defined('FTP_PUBKEY') ); ?> size="40" />
- <br /><input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php disabled( defined('FTP_PRIKEY') ); ?> size="40" />
-<div><?php _e('Enter the location on the server where the keys are located. If a passphrase is needed, enter that in the password field above.') ?></div></td>
-</tr>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<h4><?php _e('Authentication Keys') ?></h4>
+<label for="public_key">
+ <span class="field-title"><?php _e('Public Key:') ?></span>
+ <input name="public_key" type="text" id="public_key" aria-describedby="auth-keys-desc" value="<?php echo esc_attr($public_key) ?>"<?php disabled( defined('FTP_PUBKEY') ); ?> />
+</label>
+<label for="private_key">
+ <span class="field-title"><?php _e('Private Key:') ?></span>
+ <input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php disabled( defined('FTP_PRIKEY') ); ?> />
+</label>
+<span id="auth-keys-desc"><?php _e('Enter the location on the server where the public and private keys are located. If a passphrase is needed, enter that in the password field above.') ?></span>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-<tr>
-<th scope="row"><?php _e('Connection Type') ?></th>
-<td>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<h4><?php _e('Connection Type') ?></h4>
</ins><span class="cx" style="display: block; padding: 0 10px"> <fieldset><legend class="screen-reader-text"><span><?php _e('Connection Type') ?></span></legend>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> $disabled = disabled( (defined('FTP_SSL') && FTP_SSL) || (defined('FTP_SSH') && FTP_SSH), true, false );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1189,17 +1186,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> </label>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endforeach; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </fieldset>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-</td>
-</tr>
-</table>
-
</del><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( (array) $extra_fields as $field ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $_POST[ $field ] ) )
</span><span class="cx" style="display: block; padding: 0 10px"> echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( wp_unslash( $_POST[ $field ] ) ) . '" />';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-submit_button( __( 'Proceed' ), 'button', 'upgrade' );
</del><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <p class="request-filesystem-credentials-action-buttons">
+ <button class="button cancel-button" data-js-action="close" type="button"><?php _e( 'Cancel' ); ?></button>
+ <?php submit_button( __( 'Proceed' ), 'button', 'upgrade', false ); ?>
+ </p>
</ins><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> </form>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1223,7 +1219,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <div id="request-filesystem-credentials-dialog" class="notification-dialog-wrap request-filesystem-credentials-dialog">
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="notification-dialog-background"></div>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <div class="notification-dialog">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <div class="notification-dialog" role="dialog" aria-labelledby="request-filesystem-credentials-title" tabindex="0">
</ins><span class="cx" style="display: block; padding: 0 10px"> <div class="request-filesystem-credentials-dialog-content">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php request_filesystem_credentials( site_url() ); ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <div>
</span></span></pre></div>
<a id="trunksrcwpadminjsupdatesjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/js/updates.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/js/updates.js 2015-04-01 02:38:25 UTC (rev 31948)
+++ trunk/src/wp-admin/js/updates.js 2015-04-01 02:47:55 UTC (rev 31949)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -79,6 +79,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> wp.updates.updateQueue = [];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Store a jQuery reference to return focus to when exiting the request credentials modal.
+ *
+ * @since 4.2.0
+ *
+ * @var jQuery object
+ */
+ wp.updates.$elToReturnFocusToFromCredentialsModal = null;
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Decrement update counts throughout the various menus.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.9.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -144,6 +153,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $message.addClass( 'updating-message' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $message.html() !== wp.updates.l10n.updating ){
+ $message.data( 'originaltext', $message.html() );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $message.text( wp.updates.l10n.updating );
</span><span class="cx" style="display: block; padding: 0 10px"> wp.a11y.speak( wp.updates.l10n.updatingMsg );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -247,12 +260,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> wp.updates.showErrorInCredentialsForm = function( message ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var $notificationDialog = $( '.notification-dialog' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $modal = $( '.notification-dialog' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Remove any existing error
- $notificationDialog.find( '.error' ).remove();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Remove any existing error.
+ $modal.find( '.error' ).remove();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $notificationDialog.find( 'h3' ).after( '<div class="error">' + message + '</div>' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $modal.find( 'h3' ).after( '<div class="error">' + message + '</div>' );
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -291,18 +304,105 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Request the users filesystem credentials if we don't have them already
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Request the users filesystem credentials if we don't have them already.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp.updates.requestFilesystemCredentials = function() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp.updates.requestFilesystemCredentials = function( event ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( wp.updates.updateDoneSuccessfully === false ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /*
+ * For the plugin install screen, return the focus to the install button
+ * after exiting the credentials request modal.
+ */
+ if ( 'plugin-install' === pagenow && event ) {
+ wp.updates.$elToReturnFocusToFromCredentialsModal = $( event.target );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> wp.updates.updateLock = true;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $( 'body' ).addClass( 'modal-open' );
- $( '#request-filesystem-credentials-dialog' ).show();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ wp.updates.requestForCredentialsModalOpen();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Keydown handler for the request for credentials modal.
+ *
+ * Close the modal when the escape key is pressed.
+ * Constrain keyboard navigation to inside the modal.
+ *
+ * @since 4.2.0
+ */
+ wp.updates.keydown = function( event ) {
+ if ( 27 === event.keyCode ) {
+ wp.updates.requestForCredentialsModalCancel();
+ } else if ( 9 === event.keyCode ) {
+ // #upgrade button must always be the last focusable element in the dialog.
+ if ( event.target.id === 'upgrade' && ! event.shiftKey ) {
+ $( '#hostname' ).focus();
+ event.preventDefault();
+ } else if ( event.target.id === 'hostname' && event.shiftKey ) {
+ $( '#upgrade' ).focus();
+ event.preventDefault();
+ }
+ }
+ };
+
+ /**
+ * Open the request for credentials modal.
+ *
+ * @since 4.2.0
+ */
+ wp.updates.requestForCredentialsModalOpen = function() {
+ var $modal = $( '#request-filesystem-credentials-dialog' );
+ $( 'body' ).addClass( 'modal-open' );
+ $modal.show();
+
+ $modal.find( '#hostname' ).focus();
+ $modal.keydown( wp.updates.keydown );
+ };
+
+ /**
+ * Close the request for credentials modal.
+ *
+ * @since 4.2.0
+ */
+ wp.updates.requestForCredentialsModalClose = function() {
+ $( '#request-filesystem-credentials-dialog' ).hide();
+ $( 'body' ).removeClass( 'modal-open' );
+ wp.updates.$elToReturnFocusToFromCredentialsModal.focus();
+ };
+
+ /**
+ * The steps that need to happen when the modal is canceled out
+ *
+ * @since 4.2.0
+ */
+ wp.updates.requestForCredentialsModalCancel = function() {
+ // no updateLock and no updateQueue means we already have cleared things up
+ var slug, $message;
+
+ if( wp.updates.updateLock === false && wp.updates.updateQueue.length === 0 ){
+ return;
+ }
+
+ slug = wp.updates.updateQueue[0].data.slug,
+
+ // remove the lock, and clear the queue
+ wp.updates.updateLock = false;
+ wp.updates.updateQueue = [];
+
+ wp.updates.requestForCredentialsModalClose();
+ if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
+ $message = $( '[data-slug="' + slug + '"]' ).next().find( '.update-message' );
+ } else if ( 'plugin-install' === pagenow ) {
+ $message = $( '.plugin-card-' + slug ).find( '.update-now' );
+ }
+
+ $message.removeClass( 'updating-message' );
+ $message.html( $message.data( 'originaltext' ) );
+ wp.a11y.speak( wp.updates.l10n.updateCancel );
+ };
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $( document ).ready( function() {
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px"> * Check whether a user needs to submit filesystem credentials based on whether
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -322,8 +422,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> wp.updates.filesystemCredentials.ssh.publicKey = $('#public_key').val();
</span><span class="cx" style="display: block; padding: 0 10px"> wp.updates.filesystemCredentials.ssh.privateKey = $('#private_key').val();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $( '#request-filesystem-credentials-dialog' ).hide();
- $( 'body' ).removeClass( 'modal-open' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp.updates.requestForCredentialsModalClose();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Unlock and invoke the queue.
</span><span class="cx" style="display: block; padding: 0 10px"> wp.updates.updateLock = false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -332,14 +431,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Close the request credentials modal when
+ $( '#request-filesystem-credentials-dialog [data-js-action="close"], .notification-dialog-background' ).on( 'click', function() {
+ wp.updates.requestForCredentialsModalCancel();
+ });
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Click handler for plugin updates in List Table view.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $( '.plugin-update-tr .update-link' ).on( 'click', function( e ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $( '.plugin-update-tr' ).on( 'click', '.update-link', function( e ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> e.preventDefault();
</span><span class="cx" style="display: block; padding: 0 10px"> if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.updateLock ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp.updates.requestFilesystemCredentials();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp.updates.requestFilesystemCredentials( e );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var $row = $( e.target ).parents( '.plugin-update-tr' );
- wp.updates.updatePlugin( $row.data( 'plugin' ), $row.data( 'slug' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var updateRow = $( e.target ).parents( '.plugin-update-tr' );
+ // Return the user to the input box of the plugin's table row after closing the modal.
+ wp.updates.$elToReturnFocusToFromCredentialsModal = $( '#' + updateRow.data( 'slug' ) ).find( '.check-column input' );
+ wp.updates.updatePlugin( updateRow.data( 'plugin' ), updateRow.data( 'slug' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $( '#bulk-action-form' ).on( 'submit', function( e ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -360,9 +466,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $( '.plugin-card .update-now' ).on( 'click', function( e ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $( '.plugin-card' ).on( 'click', '.update-now', function( e ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> e.preventDefault();
</span><span class="cx" style="display: block; padding: 0 10px"> var $button = $( e.target );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.updateLock ) {
+ wp.updates.requestFilesystemCredentials( e );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> wp.updates.updatePlugin( $button.data( 'plugin' ), $button.data( 'slug' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpincludesscriptloaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/script-loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/script-loader.php 2015-04-01 02:38:25 UTC (rev 31948)
+++ trunk/src/wp-includes/script-loader.php 2015-04-01 02:47:55 UTC (rev 31949)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -529,6 +529,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'updateFailed' => __( 'Update failed.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'updatingMsg' => __( 'Updating... please wait.' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'updatedMsg' => __( 'Update completed successfully.' ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'updateCancel' => __( 'Update canceled' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> )
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre>
</div>
</div>
</body>
</html>