Ticket #31608: 31608.3.patch
| File 31608.3.patch, 11.9 KB (added by , 11 years ago) |
|---|
-
src/wp-admin/css/forms.css
864 864 margin: 25px; 865 865 } 866 866 867 .request-filesystem-credentials- dialog-contentinput[type="text"],868 .request-filesystem-credentials- dialog-contentinput[type="password"] {869 width: 85%;867 .request-filesystem-credentials-form input[type="text"], 868 .request-filesystem-credentials-form input[type="password"] { 869 display: block; 870 870 } 871 871 872 .request-filesystem-credentials-dialog input[type="text"], 873 .request-filesystem-credentials-dialog input[type="password"] { 874 width: 100%; 875 } 876 877 .request-filesystem-credentials-form .field-title { 878 font-weight: 600; 879 } 880 881 .request-filesystem-credentials-dialog label[for="hostname"], 882 .request-filesystem-credentials-dialog label[for="public_key"], 883 .request-filesystem-credentials-dialog label[for="private_key"] { 884 display: block; 885 margin-bottom: 1em; 886 } 887 888 .request-filesystem-credentials-dialog .ftp-username, 889 .request-filesystem-credentials-dialog .ftp-password { 890 float: left; 891 width: 48%; 892 } 893 894 .request-filesystem-credentials-dialog .ftp-password { 895 margin-left: 4%; 896 } 897 898 .request-filesystem-credentials-dialog .request-filesystem-credentials-action-buttons { 899 text-align: right; 900 } 901 902 .request-filesystem-credentials-dialog label[for="ftp"] { 903 margin-right: 10px; 904 } 905 906 #request-filesystem-credentials-dialog .button:not(:last-child) { 907 margin-right: 10px; 908 } 909 910 #request-filesystem-credentials-form .cancel-button { 911 display: none; 912 } 913 914 #request-filesystem-credentials-dialog .cancel-button { 915 display: inline; 916 } 917 918 872 919 /* =Media Queries 873 920 -------------------------------------------------------------- */ 874 921 -
src/wp-admin/includes/file.php
1112 1112 --> 1113 1113 </script> 1114 1114 <form action="<?php echo esc_url( $form_post ) ?>" method="post"> 1115 <div >1116 <h3 ><?php _e('Connection Information') ?></h3>1117 <p ><?php1115 <div id="request-filesystem-credentials-form" class="request-filesystem-credentials-form"> 1116 <h3 id="request-filesystem-credentials-title"><?php _e( 'Connection Information' ) ?></h3> 1117 <p id="request-filesystem-credentials-desc"><?php 1118 1118 $label_user = __('Username'); 1119 1119 $label_pass = __('Password'); 1120 1120 _e('To perform the requested action, WordPress needs to access your web server.'); … … 1133 1133 } 1134 1134 _e('If you do not remember your credentials, you should contact your web host.'); 1135 1135 ?></p> 1136 < table class="form-table">1137 <tr>1138 <th scope="row"><label for="hostname"><?php _e('Hostname') ?></label></th>1139 < 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>1140 < /tr>1141 1142 <tr>1143 <th scope="row"><label for="username"><?php echo $label_user; ?></label></th>1144 <td><input name="username" type="text" id="username" value="<?php echo esc_attr($username) ?>"<?php disabled( defined('FTP_USER') ); ?> size="40" /></td>1145 </ tr>1146 1147 <tr>1148 <th scope="row"><label for="password"><?php echo $label_pass; ?></label></th>1149 <td><div><input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php disabled( defined('FTP_PASS') ); ?> size="40" /></div>1150 <div><em><?php if ( ! defined('FTP_PASS') ) _e( 'This password will not be stored on the server.' ); ?></em></div></td>1151 </tr>1152 1136 <label for="hostname"> 1137 <span class="field-title"><?php _e( 'Hostname' ) ?></span> 1138 <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') ); ?> /> 1139 </label> 1140 <div class="ftp-username"> 1141 <label for="username"> 1142 <span class="field-title"><?php echo $label_user; ?></span> 1143 <input name="username" type="text" id="username" value="<?php echo esc_attr($username) ?>"<?php disabled( defined('FTP_USER') ); ?> /> 1144 </label> 1145 </div> 1146 <div class="ftp-password"> 1147 <label for="password"> 1148 <span class="field-title"><?php echo $label_pass; ?></span> 1149 <input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php disabled( defined('FTP_PASS') ); ?> /> 1150 <em><?php if ( ! defined('FTP_PASS') ) _e( 'This password will not be stored on the server.' ); ?></em> 1151 </label> 1152 </div> 1153 1153 <?php if ( isset($types['ssh']) ) : ?> 1154 < tr id="ssh_keys" style="<?php if ( 'ssh' != $connection_type ) echo 'display:none' ?>">1155 < th scope="row"><?php _e('Authentication Keys') ?>1156 <div class="key-labels textright">1157 <label for="public_key"><?php _e('Public Key:') ?></label ><br/>1158 < label for="private_key"><?php _e('Private Key:') ?></label>1159 < /div></th>1160 <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" />1161 < br /><input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php disabled( defined('FTP_PRIKEY') ); ?> size="40"/>1162 < 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>1163 < /tr>1154 <h4><?php _e('Authentication Keys') ?></h4> 1155 <label for="public_key"> 1156 <span class="field-title"><?php _e('Public Key:') ?></span> 1157 <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') ); ?> /> 1158 </label> 1159 <label for="private_key"> 1160 <span class="field-title"><?php _e('Private Key:') ?></span> 1161 <input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php disabled( defined('FTP_PRIKEY') ); ?> /> 1162 </label> 1163 <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> 1164 1164 <?php endif; ?> 1165 1166 <tr> 1167 <th scope="row"><?php _e('Connection Type') ?></th> 1168 <td> 1165 <h4><?php _e('Connection Type') ?></h4> 1169 1166 <fieldset><legend class="screen-reader-text"><span><?php _e('Connection Type') ?></span></legend> 1170 1167 <?php 1171 1168 $disabled = disabled( (defined('FTP_SSL') && FTP_SSL) || (defined('FTP_SSH') && FTP_SSH), true, false ); … … 1176 1173 </label> 1177 1174 <?php endforeach; ?> 1178 1175 </fieldset> 1179 </td>1180 </tr>1181 </table>1182 1183 1176 <?php 1184 1177 foreach ( (array) $extra_fields as $field ) { 1185 1178 if ( isset( $_POST[ $field ] ) ) 1186 1179 echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( wp_unslash( $_POST[ $field ] ) ) . '" />'; 1187 1180 } 1188 submit_button( __( 'Proceed' ), 'button', 'upgrade' );1189 1181 ?> 1182 <p class="request-filesystem-credentials-action-buttons"> 1183 <button class="button cancel-button" data-js-action="close" type="button"><?php _e( 'Cancel' ); ?></button> 1184 <?php submit_button( __( 'Proceed' ), 'button', 'upgrade', false ); ?> 1185 </p> 1190 1186 </div> 1191 1187 </form> 1192 1188 <?php … … 1194 1190 } 1195 1191 1196 1192 /** 1197 * Print the credentials modal when needed 1193 * Print the credentials modal when needed 1198 1194 * 1199 1195 * @since 4.2.0 1200 1196 */ … … 1210 1206 ?> 1211 1207 <div id="request-filesystem-credentials-dialog" class="notification-dialog-wrap request-filesystem-credentials-dialog"> 1212 1208 <div class="notification-dialog-background"></div> 1213 <div class="notification-dialog" >1209 <div class="notification-dialog" role="dialog" aria-labelledby="request-filesystem-credentials-title" tabindex="0"> 1214 1210 <div class="request-filesystem-credentials-dialog-content"> 1215 1211 <?php request_filesystem_credentials( site_url() ); ?> 1216 1212 <div> -
src/wp-admin/js/updates.js
392 392 * 393 393 * @since 4.2.0 394 394 */ 395 wp.updates.requestFilesystemCredentials = function( ) {395 wp.updates.requestFilesystemCredentials = function( event ) { 396 396 if ( wp.updates.updateDoneSuccessfully === false ) { 397 var $dialog = $( '#request-filesystem-credentials-dialog' ); 398 // Get the clicked element 399 wp.updates.activeEl = $( event.target ); 400 397 401 wp.updates.updateLock = true; 398 402 $( 'body' ).addClass( 'modal-open' ); 399 $( '#request-filesystem-credentials-dialog' ).show(); 403 $dialog.show(); 404 405 // Set focus to the modal first input 406 $dialog.find( '#hostname' ).focus(); 407 // Bind keydown event handler 408 $dialog.keydown( wp.updates.keydown ); 400 409 } 401 410 }; 402 411 412 /** 413 * Close on Escape and constrain keyboard navigation inside the Credentials modal. 414 * 415 * @since 4.2.0 416 */ 417 wp.updates.keydown = function( event ) { 418 var id, 419 key = event.keyCode || event.charCode; 420 421 if ( 27 === key ) { 422 wp.updates.dialogClose(); 423 } else if ( 9 === key ) { 424 id = event.target.id; 425 // #upgrade button must always be the last focusable element in the dialog. 426 if ( id === 'upgrade' && ! event.shiftKey ) { 427 $( '#hostname' ).focus(); 428 event.preventDefault(); 429 } else if ( id === 'hostname' && event.shiftKey ) { 430 $( '#upgrade' ).focus(); 431 event.preventDefault(); 432 } 433 } 434 }; 435 436 /** 437 * Store the active element that was clicked before the Credentials modal opens. 438 * 439 * @since 4.2.0 440 * 441 * @var jQuery object 442 */ 443 wp.updates.activeEl = null; 444 445 /** 446 * Store the active update row. 447 * 448 * @since 4.2.0 449 * 450 * @var jQuery object 451 */ 452 wp.updates.updateRow = null; 453 403 454 $( document ).ready( function() { 404 455 /* 405 456 * Check whether a user needs to submit filesystem credentials based on whether … … 419 470 wp.updates.filesystemCredentials.ssh.publicKey = $('#public_key').val(); 420 471 wp.updates.filesystemCredentials.ssh.privateKey = $('#private_key').val(); 421 472 422 $( '#request-filesystem-credentials-dialog' ).hide(); 423 $( 'body' ).removeClass( 'modal-open' ); 473 wp.updates.dialogClose(); 424 474 425 475 // Unlock and invoke the queue. 426 476 wp.updates.updateLock = false; … … 429 479 return false; 430 480 }); 431 481 482 wp.updates.dialogClose = function() { 483 var slug; 484 485 $( '#request-filesystem-credentials-dialog' ).hide(); 486 $( 'body' ).removeClass( 'modal-open' ); 487 // Plugin updates: set focus back to the Select checkbox. 488 if ( wp.updates.updateRow ) { 489 slug = wp.updates.updateRow.data( 'slug' ); 490 $( '#' + slug ).find( '.check-column input' ).focus(); 491 // Plugin install: set focus back to the Install button. 492 } else { 493 wp.updates.activeEl.focus(); 494 } 495 }; 496 497 $( '#request-filesystem-credentials-dialog [data-js-action="close"], #request-filesystem-credentials-dialog' ).on( 'click', function() { 498 wp.updates.dialogClose(); 499 }); 500 432 501 // Click handler for plugin updates in List Table view. 433 502 $( '.plugin-update-tr .update-link' ).on( 'click', function( e ) { 434 503 e.preventDefault(); 435 504 if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.updateLock ) { 436 wp.updates.requestFilesystemCredentials( );505 wp.updates.requestFilesystemCredentials( e ); 437 506 } 438 var $row = $( e.target ).parents( '.plugin-update-tr' );439 wp.updates.updatePlugin( $row.data( 'plugin' ), $row.data( 'slug' ) );507 wp.updates.updateRow = $( e.target ).parents( '.plugin-update-tr' ); 508 wp.updates.updatePlugin( wp.updates.updateRow.data( 'plugin' ), wp.updates.updateRow.data( 'slug' ) ); 440 509 } ); 441 510 442 511 $( '#bulk-action-form' ).on( 'submit', function( e ) { … … 466 535 $( '.plugin-card .install-now' ).on( 'click', function( e ) { 467 536 e.preventDefault(); 468 537 if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.updateLock ) { 469 wp.updates.requestFilesystemCredentials( );538 wp.updates.requestFilesystemCredentials( e ); 470 539 } 471 540 var $button = $( e.target ); 472 541 if ( $button.hasClass( 'button-disabled' ) ) {