Network admin theme install. props PeteMall, fixes #15184.

git-svn-id: http://svn.automattic.com/wordpress/trunk@15898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-10-21 17:06:52 +00:00
parent a724633db8
commit 66a2572a2e
6 changed files with 41 additions and 18 deletions

View File

@ -1358,11 +1358,11 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
);
if ( $this->type == 'web' )
$install_actions['themes_page'] = '<a href="' . admin_url('theme-install.php') . '" title="' . esc_attr__('Return to Theme Installer') . '" target="_parent">' . __('Return to Theme Installer') . '</a>';
$install_actions['themes_page'] = '<a href="' . self_admin_url('theme-install.php') . '" title="' . esc_attr__('Return to Theme Installer') . '" target="_parent">' . __('Return to Theme Installer') . '</a>';
else
$install_actions['themes_page'] = '<a href="' . admin_url('themes.php') . '" title="' . esc_attr__('Themes page') . '" target="_parent">' . __('Return to Themes page') . '</a>';
$install_actions['themes_page'] = '<a href="' . self_admin_url('themes.php') . '" title="' . esc_attr__('Themes page') . '" target="_parent">' . __('Return to Themes page') . '</a>';
if ( ! $this->result || is_wp_error($this->result) )
if ( ! $this->result || is_wp_error($this->result) || is_network_admin() )
unset( $install_actions['activate'], $install_actions['preview'] );
$install_actions = apply_filters('install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info);

View File

@ -4184,7 +4184,7 @@ class WP_Theme_Install_Table extends WP_List_Table {
$display_tabs = array();
foreach ( (array) $tabs as $action => $text ) {
$class = ( $action == $tab ) ? ' class="current"' : '';
$href = admin_url('theme-install.php?tab=' . $action);
$href = self_admin_url('theme-install.php?tab=' . $action);
$display_tabs[$action] = "<a href='$href'$class>$text</a>";
}

View File

@ -77,7 +77,7 @@ function install_themes_dashboard() {
install_theme_search_form();
?>
<h4><?php _e('Feature Filter') ?></h4>
<form method="post" action="<?php echo admin_url( 'theme-install.php?tab=search' ); ?>">
<form method="post" action="<?php echo self_admin_url( 'theme-install.php?tab=search' ); ?>">
<p class="install-help"><?php _e('Find a theme based on specific features') ?></p>
<?php
$feature_list = get_theme_feature_list( );
@ -116,7 +116,7 @@ function install_themes_upload($page = 1) {
?>
<h4><?php _e('Install a theme in .zip format') ?></h4>
<p class="install-help"><?php _e('If you have a theme in a .zip format, you may install it by uploading it here.') ?></p>
<form method="post" enctype="multipart/form-data" action="<?php echo admin_url('update.php?action=upload-theme') ?>">
<form method="post" enctype="multipart/form-data" action="<?php echo self_admin_url('update.php?action=upload-theme') ?>">
<?php wp_nonce_field( 'theme-upload') ?>
<input type="file" name="themezip" />
<input type="submit"
@ -140,9 +140,10 @@ function display_theme($theme, $actions = null, $show_details = true) {
$preview_link = $theme->preview_url . '?TB_iframe=true&amp;width=600&amp;height=400';
if ( !is_array($actions) ) {
$actions = array();
$actions[] = '<a href="' . admin_url('theme-install.php?tab=theme-information&amp;theme=' . $theme->slug .
$actions[] = '<a href="' . self_admin_url('theme-install.php?tab=theme-information&amp;theme=' . $theme->slug .
'&amp;TB_iframe=true&amp;tbWidth=500&amp;tbHeight=385') . '" class="thickbox thickbox-preview onclick" title="' . esc_attr(sprintf(__('Install &#8220;%s&#8221;'), $name)) . '">' . __('Install') . '</a>';
$actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview onclick previewlink" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)) . '">' . __('Preview') . '</a>';
if ( !is_network_admin() )
$actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview onclick previewlink" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)) . '">' . __('Preview') . '</a>';
$actions = apply_filters('theme_install_action_links', $actions, $theme);
}
@ -288,12 +289,12 @@ switch ( $type ) {
default:
case 'install':
if ( current_user_can('install_themes') ) :
$buttons .= '<a class="button-primary" id="install" href="' . wp_nonce_url(admin_url('update.php?action=install-theme&theme=' . $api->slug), 'install-theme_' . $api->slug) . '" target="_parent">' . __('Install Now') . '</a>';
$buttons .= '<a class="button-primary" id="install" href="' . wp_nonce_url(self_admin_url('update.php?action=install-theme&theme=' . $api->slug), 'install-theme_' . $api->slug) . '" target="_parent">' . __('Install Now') . '</a>';
endif;
break;
case 'update_available':
if ( current_user_can('update_themes') ) :
$buttons .= '<a class="button-primary" id="install" href="' . wp_nonce_url(admin_url('update.php?action=upgrade-theme&theme=' . $update_file), 'upgrade-theme_' . $update_file) . '" target="_parent">' . __('Install Update Now') . '</a>';
$buttons .= '<a class="button-primary" id="install" href="' . wp_nonce_url(self_admin_url('update.php?action=upgrade-theme&theme=' . $update_file), 'upgrade-theme_' . $update_file) . '" target="_parent">' . __('Install Update Now') . '</a>';
endif;
break;
case 'newer_installed':

View File

@ -19,7 +19,11 @@ $submenu['sites.php'][5] = array( __('Sites'), 'manage_sites', 'sites.php' );
$submenu['sites.php'][10] = array( __('Add New'), 'manage_sites', 'site-new.php' );
$menu[10] = array(__('Users'), 'manage_network_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'div');
$menu[15] = array(__('Themes'), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div');
$submenu['themes.php'][5] = array( __('Themes'), 'manage_network_themes', 'themes.php' );
$submenu['themes.php'][10] = array( _x('Add New', 'theme'), 'manage_network_themes', 'theme-install.php' );
$submenu['themes.php'][15] = array( _x('Editor', 'theme editor'), 'edit_themes', 'theme-editor.php' );
$plugin_update_count = $theme_update_count = $wordpress_update_count = 0;
$update_plugins = get_site_transient( 'update_plugins' );
@ -59,9 +63,6 @@ unset($plugin_update_count, $theme_update_count, $wordpress_update_count, $updat
$menu[99] = array( '', 'read', 'separator-last', '', 'wp-menu-separator-last' );
$submenu['themes.php'][5] = array( __('Themes'), 'manage_network_themes', 'themes.php' );
$submenu['themes.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_themes', 'theme-editor.php' );
require_once(ABSPATH . 'wp-admin/includes/menu.php');
?>

View File

@ -0,0 +1,12 @@
<?php
/**
* Install theme network administration panel.
*
* @package WordPress
* @subpackage Administration
* @since 3.1.0
*/
require_once( './admin.php' );
require( '../theme-install.php' );

View File

@ -15,7 +15,8 @@ $wp_list_table->prepare_items();
$title = __('Install Themes');
$parent_file = 'themes.php';
$submenu_file = 'themes.php';
if ( !is_network_admin() )
$submenu_file = 'themes.php';
wp_enqueue_style( 'theme-install' );
wp_enqueue_script( 'theme-install' );
@ -35,17 +36,25 @@ $help .= '<p>' . __('<a href="http://codex.wordpress.org/Using_Themes#Adding_New
$help .= '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>';
add_contextual_help($current_screen, $help);
include('./admin-header.php');
include(ABSPATH . 'wp-admin/admin-header.php');
?>
<div class="wrap">
<?php screen_icon(); ?>
<?php
screen_icon();
if ( is_network_admin() ) : ?>
<h2><?php echo esc_html( $title ); ?></h2>
<?php else : ?>
<h2><a href="themes.php" class="nav-tab"><?php echo esc_html_x('Manage Themes', 'theme'); ?></a><a href="theme-install.php" class="nav-tab nav-tab-active"><?php echo esc_html( $title ); ?></a></h2>
<?php $wp_list_table->views(); ?>
<?php
endif;
$wp_list_table->views(); ?>
<br class="clear" />
<?php do_action('install_themes_' . $tab, $paged); ?>
</div>
<?php
include('./admin-footer.php');
include(ABSPATH . 'wp-admin/admin-footer.php');