Make WordPress Core


Ignore:
Timestamp:
02/24/2009 02:37:22 AM (17 years ago)
Author:
azaozz
Message:

Allow the dashboard widgets to be arranged in up to four columns. The number of columns can be selected from the Screen Options tab.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/template.php

    r10629 r10641  
    33013301    <br class="clear" />
    33023302    </div></form>
     3303<?php echo screen_layout($screen); ?>
    33033304</div>
    33043305
     
    33113312        $_wp_contextual_help = array();
    33123313
    3313     if ( !isset($_wp_contextual_help['post']) ) {
    3314         $help = drag_drop_help();
    3315         $help .= '<p>' . __('<a href="http://codex.wordpress.org/Writing_Posts" target="_blank">Writing Posts</a>') . '</p>';
    3316         $_wp_contextual_help['post'] = $help;
    3317     }
    3318 
    3319     if ( !isset($_wp_contextual_help['page']) ) {
    3320         $help = drag_drop_help();
    3321         $_wp_contextual_help['page'] = $help;
    3322     }
    3323 
    3324     if ( !isset($_wp_contextual_help['dashboard']) ) {
    3325         $help = drag_drop_help();
    3326         $_wp_contextual_help['dashboard'] = $help;
    3327     }
    3328 
    3329     if ( !isset($_wp_contextual_help['link']) ) {
    3330         $help = drag_drop_help();
    3331         $_wp_contextual_help['link'] = $help;
    3332     }
    3333 
    3334     if ( !isset($_wp_contextual_help['options-general']) )
    3335         $_wp_contextual_help['options-general'] =  __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">General Settings</a>');
     3314    switch ( $screen ) {
     3315        case 'post':
     3316            if ( !isset($_wp_contextual_help['post']) ) {
     3317                $help = drag_drop_help();
     3318                $help .= '<p>' . __('<a href="http://codex.wordpress.org/Writing_Posts" target="_blank">Writing Posts</a>') . '</p>';
     3319                $_wp_contextual_help['post'] = $help;
     3320            }
     3321            break;
     3322        case 'page':
     3323            if ( !isset($_wp_contextual_help['page']) ) {
     3324                $help = drag_drop_help();
     3325                $_wp_contextual_help['page'] = $help;
     3326            }
     3327            break;
     3328        case 'dashboard':
     3329            if ( !isset($_wp_contextual_help['dashboard']) ) {
     3330                $help = '<p>' . __('The modules on this screen can be arranged in several columns. You can select the number of columns from the Screen Options tab.') . "</p>\n";
     3331                $help .= drag_drop_help();
     3332                $_wp_contextual_help['dashboard'] = $help;
     3333            }
     3334            break;
     3335        case 'link':
     3336            if ( !isset($_wp_contextual_help['link']) ) {
     3337                $help = drag_drop_help();
     3338                $_wp_contextual_help['link'] = $help;
     3339            }
     3340            break;
     3341        case 'options-general':
     3342            if ( !isset($_wp_contextual_help['options-general']) )
     3343                $_wp_contextual_help['options-general'] =  __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">General Settings</a>');
     3344            break;
     3345    }
    33363346
    33373347    $_wp_contextual_help = apply_filters('contextual_help_list', $_wp_contextual_help, $screen);
     
    33993409}
    34003410
     3411
     3412function screen_layout($screen) {
     3413    global $screen_layout_columns;
     3414
     3415    if ( 'dashboard' == $screen ) {
     3416        $screen_layout_columns = get_user_option('screen_layout_dashboard');
     3417        $num = 4;
     3418/* add to the write pages?
     3419    } elseif ( in_array( $screen, array('post', 'page', 'link') ) ) {
     3420        $screen_layout_columns = get_user_option('screen_layout_write');
     3421        $num = 2;
     3422*/
     3423    } else {
     3424        $screen_layout_columns = 0;
     3425        return '';
     3426    }
     3427   
     3428    if ( ! $screen_layout_columns )
     3429            $screen_layout_columns = 2;
     3430
     3431    $i = 1;
     3432    $return = '<h5>' . __('Screen Layout') . "</h5>\n<div class='columns-prefs'>" . __('Number of Columns:') . "\n";
     3433    while ( $i <= $num ) {
     3434        $return .= "<label><input type='radio' name='screen_columns' value='$i'" . ( ($screen_layout_columns == $i) ? " checked='checked'" : "" ) . " /> $i</label>\n";
     3435        ++$i;
     3436    }
     3437    $return .= "</div>\n";
     3438    return $return;
     3439}
     3440
    34013441function screen_icon($name = '') {
    34023442    global $parent_file, $hook_suffix;
Note: See TracChangeset for help on using the changeset viewer.