Toggle between "Show Details" and "Hide Details" on GUU; Add no-js CSS class support to generic iframe header. Props ocean90. Fixes #12919

git-svn-id: http://svn.automattic.com/wordpress/trunk@14123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2010-04-17 12:27:13 +00:00
parent eb74c91d9f
commit e56cc6ce28
2 changed files with 20 additions and 6 deletions

View File

@ -1055,7 +1055,7 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
function add_strings() { function add_strings() {
$this->upgrader->strings['skin_update_failed_error'] = __('An error occured while updating %1$s: <strong>%2$s</strong>.'); $this->upgrader->strings['skin_update_failed_error'] = __('An error occured while updating %1$s: <strong>%2$s</strong>.');
$this->upgrader->strings['skin_update_failed'] = __('The update of %1$s failed.'); $this->upgrader->strings['skin_update_failed'] = __('The update of %1$s failed.');
$this->upgrader->strings['skin_update_successful'] = __('%1$s updated successfully. <a onclick="%2$s" href="#">See Details</a>.'); $this->upgrader->strings['skin_update_successful'] = __('%1$s updated successfully. <a onclick="%2$s" href="#" class="hide-if-no-js"><span>Show Details</span><span class="hidden">Hide Details</span>.</a>');
} }
function feedback($string) { function feedback($string) {
@ -1087,7 +1087,7 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
if ( is_string($error) && isset( $this->upgrader->strings[$error] ) ) if ( is_string($error) && isset( $this->upgrader->strings[$error] ) )
$this->error = $this->upgrader->strings[$error]; $this->error = $this->upgrader->strings[$error];
if ( is_wp_error($error) && $error->get_error_code() ) { if ( is_wp_error($error) ) {
foreach ( $error->get_error_messages() as $emessage ) { foreach ( $error->get_error_messages() as $emessage ) {
if ( $error->get_error_data() ) if ( $error->get_error_data() )
$messages[] = $emessage . ' ' . $error->get_error_data(); $messages[] = $emessage . ' ' . $error->get_error_data();
@ -1101,7 +1101,7 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
function before($title = '') { function before($title = '') {
$this->in_loop = true; $this->in_loop = true;
printf( '<h4>' . $this->upgrader->strings['skin_before_update_header'] . '</h4>', $title, $this->upgrader->update_current, $this->upgrader->update_count); printf( '<h4>' . $this->upgrader->strings['skin_before_update_header'] . '</h4>', $title, $this->upgrader->update_current, $this->upgrader->update_count);
echo '<div class="update-messages" style="display:none" id="progress-' . esc_attr($this->upgrader->update_current) . '"><p>'; echo '<div class="update-messages hide-if-js" id="progress-' . esc_attr($this->upgrader->update_current) . '"><p>';
$this->flush_output(); $this->flush_output();
} }
@ -1116,7 +1116,7 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
echo '<script type="text/javascript">jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').show();</script>'; echo '<script type="text/javascript">jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').show();</script>';
} }
if ( !empty($this->result) && !is_wp_error($this->result) ) { if ( !empty($this->result) && !is_wp_error($this->result) ) {
echo '<div class="updated"><p>' . sprintf($this->upgrader->strings['skin_update_successful'], $title, 'jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').toggle(); return false;') . '</p></div>'; echo '<div class="updated"><p>' . sprintf($this->upgrader->strings['skin_update_successful'], $title, 'jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').toggle();jQuery(\'span\', this).toggle(); return false;') . '</p></div>';
} }
$this->reset(); $this->reset();
$this->flush_output(); $this->flush_output();

View File

@ -3464,6 +3464,7 @@ function _admin_search_query() {
* *
*/ */
function iframe_header( $title = '', $limit_styles = false ) { function iframe_header( $title = '', $limit_styles = false ) {
global $hook_suffix;
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>> <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
<head> <head>
@ -3485,9 +3486,22 @@ function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_r
do_action('admin_print_styles'); do_action('admin_print_styles');
do_action('admin_print_scripts'); do_action('admin_print_scripts');
do_action('admin_head'); do_action('admin_head');
$admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
if ( get_user_setting('mfold') == 'f' )
$admin_body_class .= ' folded';
?> ?>
</head> </head>
<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?>> <body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-admin no-js<?php echo apply_filters( 'admin_body_class', '' ) . " $admin_body_class"; ?>">
<script type="text/javascript">
//<![CDATA[
(function(){
var c = document.body.className;
c = c.replace(/no-js/, 'js');
document.body.className = c;
})();
//]]>
</script>
<?php <?php
} }