Changeset 41997
- Timestamp:
- 10/24/2017 07:05:48 PM (7 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-controls.js
r41969 r41997 2987 2987 */ 2988 2988 attachEvents: function() { 2989 var panel = this , toggleDisabledNotification;2989 var panel = this; 2990 2990 2991 2991 // Attach regular panel events. 2992 2992 api.Panel.prototype.attachEvents.apply( panel ); 2993 2993 2994 toggleDisabledNotification = function() { 2994 // Temporary since supplying SFTP credentials does not work yet. See #42184 2995 if ( api.settings.theme._filesystemCredentialsNeeded ) { 2996 panel.notifications.add( new api.Notification( 'theme_install_unavailable', { 2997 message: api.l10n.themeInstallUnavailable, 2998 type: 'info', 2999 dismissible: true 3000 } ) ); 3001 } 3002 3003 function toggleDisabledNotifications() { 2995 3004 if ( 'publish' === api.state( 'selectedChangesetStatus' ).get() ) { 2996 3005 panel.notifications.remove( 'theme_switch_unavailable' ); … … 3001 3010 } ) ); 3002 3011 } 3003 } ;3004 toggleDisabledNotification ();3005 api.state( 'selectedChangesetStatus' ).bind( toggleDisabledNotification );3012 } 3013 toggleDisabledNotifications(); 3014 api.state( 'selectedChangesetStatus' ).bind( toggleDisabledNotifications ); 3006 3015 3007 3016 // Collapse panel to customize the current theme. … … 3096 3105 var panel = this, preview, onInstallSuccess, slug = $( event.target ).data( 'slug' ), deferred = $.Deferred(), request; 3097 3106 preview = $( event.target ).hasClass( 'preview' ); 3107 3108 // Temporary since supplying SFTP credentials does not work yet. See #42184. 3109 if ( api.settings.theme._filesystemCredentialsNeeded ) { 3110 deferred.reject({ 3111 errorCode: 'theme_install_unavailable' 3112 }); 3113 return deferred.promise(); 3114 } 3098 3115 3099 3116 // Prevent loading a non-active theme preview when there is a drafted/scheduled changeset. … … 3296 3313 3297 3314 event.preventDefault(); 3315 3316 // Temporary since supplying SFTP credentials does not work yet. See #42184. 3317 if ( api.settings.theme._filesystemCredentialsNeeded ) { 3318 return; 3319 } 3298 3320 3299 3321 // Confirmation dialog for deleting a theme. … … 4984 5006 */ 4985 5007 ready: function() { 4986 var control = this , disableSwitchButtons, updateButtons;4987 4988 disableSwitchButtons = function() {5008 var control = this; 5009 5010 function disableSwitchButtons() { 4989 5011 return 'publish' !== api.state( 'selectedChangesetStatus' ).get() && control.params.theme.id !== api.settings.theme.stylesheet; 4990 }; 4991 updateButtons = function() { 4992 control.container.find( 'button' ).toggleClass( 'disabled', disableSwitchButtons() ); 4993 }; 4994 4995 api.state( 'selectedChangesetStatus' ).bind( updateButtons ); 5012 } 5013 5014 // Temporary special function since supplying SFTP credentials does not work yet. See #42184. 5015 function disableInstallButtons() { 5016 return disableSwitchButtons() || true === api.settings.theme._filesystemCredentialsNeeded; 5017 } 5018 function updateButtons( container ) { 5019 var _container = container || control.container; 5020 _container.find( 'button.preview, button.preview-theme' ).toggleClass( 'disabled', disableSwitchButtons() ); 5021 _container.find( 'button.theme-install' ).toggleClass( 'disabled', disableInstallButtons() ); 5022 } 5023 5024 api.state( 'selectedChangesetStatus' ).bind( function() { 5025 updateButtons(); 5026 }); 4996 5027 updateButtons(); 4997 5028 … … 5020 5051 section = api.section( control.section() ); 5021 5052 section.showDetails( control.params.theme, function() { 5022 section.overlay.find( '.theme-actions button' ).toggleClass( 'disabled', disableSwitchButtons() ); 5053 updateButtons( section.overlay.find( '.theme-actions' ) ); 5054 5055 // Temporary special function since supplying SFTP credentials does not work yet. See #42184. 5056 if ( api.settings.theme._filesystemCredentialsNeeded ) { 5057 section.overlay.find( '.theme-actions .delete-theme' ).remove(); 5058 } 5023 5059 } ); 5024 5060 }); -
trunk/src/wp-includes/class-wp-customize-manager.php
r41989 r41997 4619 4619 ); 4620 4620 4621 // Temporarily disable installation in Customizer. See #42184. 4622 $filesystem_method = get_filesystem_method(); 4623 ob_start(); 4624 $filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() ); 4625 ob_end_clean(); 4626 if ( 'direct' !== $filesystem_method && ! $filesystem_credentials_are_stored ) { 4627 $settings['theme']['_filesystemCredentialsNeeded'] = true; 4628 } 4629 4621 4630 // Prepare Customize Section objects to pass to JavaScript. 4622 4631 foreach ( $this->sections() as $id => $section ) { -
trunk/src/wp-includes/script-loader.php
r41977 r41997 594 594 'scheduleDescription' => __( 'Schedule your customization changes to publish ("go live") at a future date.' ), 595 595 'themePreviewUnavailable' => __( 'Sorry, you can’t preview new themes when you have changes scheduled or saved as a draft. Please publish your changes, or wait until they publish to preview new themes.' ), 596 'themeInstallUnavailable' => sprintf( 597 /* translators: %s is URL to Add Themes admin screen */ 598 __( 'You won’t be able to install new themes from here yet since your install requires SFTP credentials. For now, please <a href="%s">add themes in the admin</a>.' ), 599 esc_url( admin_url( 'theme-install.php' ) ) 600 ), 596 601 ) ); 597 602 $scripts->add( 'customize-selective-refresh', "/wp-includes/js/customize-selective-refresh$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 );
Note: See TracChangeset
for help on using the changeset viewer.