Ticket #31608: 31608.7.diff
| File 31608.7.diff, 14.7 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 … … 1098 1145 max-width: 400px; 1099 1146 width: auto; 1100 1147 } 1148 1101 1149 } 1102 1150 1151 @media only screen and (max-height: 480px) { 1152 /* Request Credentials */ 1153 .request-filesystem-credentials-dialog .notification-dialog{ 1154 width: 100%; 1155 height: 100%; 1156 position: fixed; 1157 top: 0; 1158 margin: 0; 1159 left: 0; 1160 overflow-y: auto; 1161 } 1162 } 1163 1103 1164 /* Smartphone */ 1104 1165 @media screen and (max-width: 600px) { 1105 1166 /* Color Picker Options */ -
src/wp-admin/includes/file.php
1125 1125 --> 1126 1126 </script> 1127 1127 <form action="<?php echo esc_url( $form_post ) ?>" method="post"> 1128 <div >1129 <h3 ><?php _e('Connection Information') ?></h3>1130 <p ><?php1128 <div id="request-filesystem-credentials-form" class="request-filesystem-credentials-form"> 1129 <h3 id="request-filesystem-credentials-title"><?php _e( 'Connection Information' ) ?></h3> 1130 <p id="request-filesystem-credentials-desc"><?php 1131 1131 $label_user = __('Username'); 1132 1132 $label_pass = __('Password'); 1133 1133 _e('To perform the requested action, WordPress needs to access your web server.'); … … 1146 1146 } 1147 1147 _e('If you do not remember your credentials, you should contact your web host.'); 1148 1148 ?></p> 1149 < table class="form-table">1150 <tr>1151 <th scope="row"><label for="hostname"><?php _e('Hostname') ?></label></th>1152 < 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>1153 < /tr>1154 1155 <tr>1156 <th scope="row"><label for="username"><?php echo $label_user; ?></label></th>1157 <td><input name="username" type="text" id="username" value="<?php echo esc_attr($username) ?>"<?php disabled( defined('FTP_USER') ); ?> size="40" /></td>1158 </ tr>1159 1160 <tr>1161 <th scope="row"><label for="password"><?php echo $label_pass; ?></label></th>1162 <td><div><input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php disabled( defined('FTP_PASS') ); ?> size="40" /></div>1163 <div><em><?php if ( ! defined('FTP_PASS') ) _e( 'This password will not be stored on the server.' ); ?></em></div></td>1164 </tr>1165 1149 <label for="hostname"> 1150 <span class="field-title"><?php _e( 'Hostname' ) ?></span> 1151 <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') ); ?> /> 1152 </label> 1153 <div class="ftp-username"> 1154 <label for="username"> 1155 <span class="field-title"><?php echo $label_user; ?></span> 1156 <input name="username" type="text" id="username" value="<?php echo esc_attr($username) ?>"<?php disabled( defined('FTP_USER') ); ?> /> 1157 </label> 1158 </div> 1159 <div class="ftp-password"> 1160 <label for="password"> 1161 <span class="field-title"><?php echo $label_pass; ?></span> 1162 <input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php disabled( defined('FTP_PASS') ); ?> /> 1163 <em><?php if ( ! defined('FTP_PASS') ) _e( 'This password will not be stored on the server.' ); ?></em> 1164 </label> 1165 </div> 1166 1166 <?php if ( isset($types['ssh']) ) : ?> 1167 < tr id="ssh_keys" style="<?php if ( 'ssh' != $connection_type ) echo 'display:none' ?>">1168 < th scope="row"><?php _e('Authentication Keys') ?>1169 <div class="key-labels textright">1170 <label for="public_key"><?php _e('Public Key:') ?></label ><br/>1171 < label for="private_key"><?php _e('Private Key:') ?></label>1172 < /div></th>1173 <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" />1174 < br /><input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php disabled( defined('FTP_PRIKEY') ); ?> size="40"/>1175 < 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>1176 < /tr>1167 <h4><?php _e('Authentication Keys') ?></h4> 1168 <label for="public_key"> 1169 <span class="field-title"><?php _e('Public Key:') ?></span> 1170 <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') ); ?> /> 1171 </label> 1172 <label for="private_key"> 1173 <span class="field-title"><?php _e('Private Key:') ?></span> 1174 <input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php disabled( defined('FTP_PRIKEY') ); ?> /> 1175 </label> 1176 <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> 1177 1177 <?php endif; ?> 1178 1179 <tr> 1180 <th scope="row"><?php _e('Connection Type') ?></th> 1181 <td> 1178 <h4><?php _e('Connection Type') ?></h4> 1182 1179 <fieldset><legend class="screen-reader-text"><span><?php _e('Connection Type') ?></span></legend> 1183 1180 <?php 1184 1181 $disabled = disabled( (defined('FTP_SSL') && FTP_SSL) || (defined('FTP_SSH') && FTP_SSH), true, false ); … … 1189 1186 </label> 1190 1187 <?php endforeach; ?> 1191 1188 </fieldset> 1192 </td>1193 </tr>1194 </table>1195 1196 1189 <?php 1197 1190 foreach ( (array) $extra_fields as $field ) { 1198 1191 if ( isset( $_POST[ $field ] ) ) 1199 1192 echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( wp_unslash( $_POST[ $field ] ) ) . '" />'; 1200 1193 } 1201 submit_button( __( 'Proceed' ), 'button', 'upgrade' );1202 1194 ?> 1195 <p class="request-filesystem-credentials-action-buttons"> 1196 <button class="button cancel-button" data-js-action="close" type="button"><?php _e( 'Cancel' ); ?></button> 1197 <?php submit_button( __( 'Proceed' ), 'button', 'upgrade', false ); ?> 1198 </p> 1203 1199 </div> 1204 1200 </form> 1205 1201 <?php … … 1223 1219 ?> 1224 1220 <div id="request-filesystem-credentials-dialog" class="notification-dialog-wrap request-filesystem-credentials-dialog"> 1225 1221 <div class="notification-dialog-background"></div> 1226 <div class="notification-dialog" >1222 <div class="notification-dialog" role="dialog" aria-labelledby="request-filesystem-credentials-title" tabindex="0"> 1227 1223 <div class="request-filesystem-credentials-dialog-content"> 1228 1224 <?php request_filesystem_credentials( site_url() ); ?> 1229 1225 <div> -
src/wp-admin/js/updates.js
79 79 wp.updates.updateQueue = []; 80 80 81 81 /** 82 * Store a jQuery reference to return focus to when exiting the request credentials modal. 83 * 84 * @since 4.2.0 85 * 86 * @var jQuery object 87 */ 88 wp.updates.$elToReturnFocusToFromCredentialsModal = null; 89 90 /** 82 91 * Decrement update counts throughout the various menus. 83 92 * 84 93 * @since 3.9.0 … … 144 153 } 145 154 146 155 $message.addClass( 'updating-message' ); 156 157 // Only needs to be set once. 158 if ( ! $message.data( 'originaltext' ) ) { 159 $message.data( 'originaltext', $message.html() ); 160 } 147 161 $message.text( wp.updates.l10n.updating ); 148 162 wp.a11y.speak( wp.updates.l10n.updatingMsg ); 149 163 … … 247 261 * @since 4.2.0 248 262 */ 249 263 wp.updates.showErrorInCredentialsForm = function( message ) { 250 var $ notificationDialog= $( '.notification-dialog' );264 var $modal = $( '.notification-dialog' ); 251 265 252 // Remove any existing error 253 $ notificationDialog.find( '.error' ).remove();266 // Remove any existing error. 267 $modal.find( '.error' ).remove(); 254 268 255 $ notificationDialog.find( 'h3' ).after( '<div class="error">' + message + '</div>' );269 $modal.find( 'h3' ).after( '<div class="error">' + message + '</div>' ); 256 270 }; 257 271 258 272 /** … … 291 305 292 306 293 307 /** 294 * Request the users filesystem credentials if we don't have them already 308 * Request the users filesystem credentials if we don't have them already. 295 309 * 296 310 * @since 4.2.0 297 311 */ 298 wp.updates.requestFilesystemCredentials = function( ) {312 wp.updates.requestFilesystemCredentials = function( event ) { 299 313 if ( wp.updates.updateDoneSuccessfully === false ) { 314 /* 315 * For the plugin install screen, return the focus to the install button 316 * after exiting the credentials request modal. 317 */ 318 if ( adminpage === 'plugin-install-php' ) { 319 wp.updates.$elToReturnFocusToFromCredentialsModal = $( event.target ); 320 } 321 300 322 wp.updates.updateLock = true; 301 $( 'body' ).addClass( 'modal-open' ); 302 $( '#request-filesystem-credentials-dialog' ).show();323 324 wp.updates.requestForCredentialsModalOpen(); 303 325 } 304 326 }; 305 327 328 /** 329 * Keydown handler for the request for credentials modal. 330 * 331 * Close the modal when the escape key is pressed. 332 * Constrain keyboard navigation to inside the modal. 333 * 334 * @since 4.2.0 335 */ 336 wp.updates.keydown = function( event ) { 337 if ( 27 === event.keyCode ) { 338 wp.updates.requestForCredentialsModalCancel(); 339 } else if ( 9 === event.keyCode ) { 340 // #upgrade button must always be the last focusable element in the dialog. 341 if ( event.target.id === 'upgrade' && ! event.shiftKey ) { 342 $( '#hostname' ).focus(); 343 event.preventDefault(); 344 } else if ( event.target.id === 'hostname' && event.shiftKey ) { 345 $( '#upgrade' ).focus(); 346 event.preventDefault(); 347 } 348 } 349 }; 350 351 /** 352 * Open the request for credentials modal. 353 * 354 * @since 4.2.0 355 */ 356 wp.updates.requestForCredentialsModalOpen = function() { 357 var $modal = $( '#request-filesystem-credentials-dialog' ); 358 $( 'body' ).addClass( 'modal-open' ); 359 $modal.show(); 360 361 $modal.find( '#hostname' ).focus(); 362 $modal.keydown( wp.updates.keydown ); 363 }; 364 365 /** 366 * Close the request for credentials modal. 367 * 368 * @since 4.2.0 369 */ 370 wp.updates.requestForCredentialsModalClose = function() { 371 $( '#request-filesystem-credentials-dialog' ).hide(); 372 $( 'body' ).removeClass( 'modal-open' ); 373 wp.updates.$elToReturnFocusToFromCredentialsModal.focus(); 374 }; 375 376 /** 377 * When the user cancels out of the credentials modal, clear all queued updates 378 * and restore the List Table to its previous state. 379 * 380 * @since 4.2.0 381 */ 382 wp.updates.requestForCredentialsModalCancel = function() { 383 wp.updates.requestForCredentialsModalClose(); 384 for ( index in wp.updates.updateQueue ) { 385 var slug = wp.updates.updateQueue[index].data.slug; 386 if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) { 387 $message = $( '[data-slug="' + slug + '"]' ).next().find( '.update-message' ); 388 } else if ( 'plugin-install' === pagenow ) { 389 $message = $( '.plugin-card-' + slug ).find( '.update-now' ); 390 } 391 $message.removeClass( 'updating-message' ); 392 $message.html( $message.data( 'originaltext' ) ); 393 } 394 wp.updates.updateQueue = []; 395 wp.updates.updateLock = false; 396 397 wp.a11y.speak( wp.updates.l10n.updateCancel ); 398 } 399 306 400 $( document ).ready( function() { 307 401 /* 308 402 * Check whether a user needs to submit filesystem credentials based on whether … … 322 416 wp.updates.filesystemCredentials.ssh.publicKey = $('#public_key').val(); 323 417 wp.updates.filesystemCredentials.ssh.privateKey = $('#private_key').val(); 324 418 325 $( '#request-filesystem-credentials-dialog' ).hide(); 326 $( 'body' ).removeClass( 'modal-open' ); 419 wp.updates.requestForCredentialsModalClose(); 327 420 328 421 // Unlock and invoke the queue. 329 422 wp.updates.updateLock = false; … … 332 425 return false; 333 426 }); 334 427 428 // Close the request credentials modal when 429 $( '#request-filesystem-credentials-dialog [data-js-action="close"], .notification-dialog-background' ).on( 'click', function() { 430 wp.updates.requestForCredentialsModalCancel(); 431 }); 432 335 433 // Click handler for plugin updates in List Table view. 336 $( '.plugin-update-tr .update-link' ).on( 'click', function( e ) {434 $( '.plugin-update-tr' ).on( 'click', '.update-link', function( e ) { 337 435 e.preventDefault(); 338 436 if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.updateLock ) { 339 wp.updates.requestFilesystemCredentials( );437 wp.updates.requestFilesystemCredentials( e ); 340 438 } 341 var $row = $( e.target ).parents( '.plugin-update-tr' ); 342 wp.updates.updatePlugin( $row.data( 'plugin' ), $row.data( 'slug' ) ); 439 var updateRow = $( e.target ).parents( '.plugin-update-tr' ); 440 // Return the user to the input box of the plugin's table row after closing the modal. 441 wp.updates.$elToReturnFocusToFromCredentialsModal = $( '#' + updateRow.data( 'slug' ) ).find( '.check-column input' ); 442 wp.updates.updatePlugin( updateRow.data( 'plugin' ), updateRow.data( 'slug' ) ); 343 443 } ); 344 444 345 445 $( '#bulk-action-form' ).on( 'submit', function( e ) { -
src/wp-includes/script-loader.php
529 529 'updateFailed' => __( 'Update failed.' ), 530 530 'updatingMsg' => __( 'Updating... please wait.' ), 531 531 'updatedMsg' => __( 'Update completed successfully.' ), 532 'updateCancel' => __( 'Update canceled' ), 532 533 ) 533 534 ) ); 534 535