Make WordPress Core


Ignore:
Timestamp:
01/04/2008 11:34:33 PM (17 years ago)
Author:
ryan
Message:

Widget admin redesign from mdawaffe. see #5583

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/widgets.php

    r6026 r6556  
    11<?php
    22
    3 require_once 'admin.php';
     3require_once( 'admin.php' );
    44
    55if ( ! current_user_can('switch_themes') )
    66    wp_die( __( 'Cheatin&#8217; uh?' ));
    77
    8 wp_enqueue_script('interface');
    9 
    10 function wp_widgets_admin_head() {
    11     global $wp_registered_sidebars, $wp_registered_widgets, $wp_registered_widget_controls;
    12 ?>
    13     <?php wp_admin_css( 'css/widgets' ); ?>
    14     <!--[if IE 7]>
    15     <style type="text/css">
    16         #palette { float: <?php echo ( get_bloginfo( 'text_direction' ) == 'rtl' ) ? 'right' : 'left'; ?>; }
    17     </style>
    18     <![endif]-->
    19 <?php
    20 
    21     $cols = array();
    22     foreach ( $wp_registered_sidebars as $index => $sidebar ) {
    23         $cols[] = '\'' . $index . '\'';
    24     }
    25     $cols = implode( ', ', $cols );
    26 
    27     $widgets = array();
    28     foreach ( $wp_registered_widgets as $name => $widget ) {
    29         $widgets[] = '\'' . $widget['id'] . '\'';
    30     }
    31     $widgets = implode( ', ', $widgets );
    32 ?>
    33 <script type="text/javascript">
    34 // <![CDATA[
    35     var cols = [<?php echo $cols; ?>];
    36     var widgets = [<?php echo $widgets; ?>];
    37     var controldims = new Array;
    38     <?php foreach ( $wp_registered_widget_controls as $name => $widget ) : ?>
    39         controldims['#<?php echo $widget['id']; ?>control'] = new Array;
    40         controldims['#<?php echo $widget['id']; ?>control']['width'] = <?php echo (int) $widget['width']; ?>;
    41         controldims['#<?php echo $widget['id']; ?>control']['height'] = <?php echo (int) $widget['height']; ?>;
    42     <?php endforeach; ?>
    43     function initWidgets() {
    44     <?php foreach ( $wp_registered_widget_controls as $name => $widget ) : ?>
    45         jQuery('#<?php echo $widget['id']; ?>popper').click(function() {popControl('#<?php echo $widget['id']; ?>control');});
    46         jQuery('#<?php echo $widget['id']; ?>closer').click(function() {unpopControl('#<?php echo $widget['id']; ?>control');});
    47         jQuery('#<?php echo $widget['id']; ?>control').Draggable({handle: '.controlhandle', zIndex: 1000});
    48         if ( true && window.opera )
    49             jQuery('#<?php echo $widget['id']; ?>control').css('border','1px solid #bbb');
    50     <?php endforeach; ?>
    51         jQuery('#shadow').css('opacity','0');
    52         jQuery(widgets).each(function(o) {o='#widgetprefix-'+o; jQuery(o).css('position','relative');} );
    53     }
    54     function resetDroppableHeights() {
    55         var max = 6;
    56         jQuery.map(cols, function(o) {
    57             var c = jQuery('#' + o + ' li').length;
    58             if ( c > max ) max = c;
    59         });
    60         var maxheight = 35 * ( max + 1);
    61         jQuery.map(cols, function(o) {
    62             height = 0 == jQuery('#' + o + ' li').length ? maxheight - jQuery('#' + o + 'placemat').height() : maxheight;
    63             jQuery('#' + o).height(height);
    64         });
    65     }
    66     function maxHeight(elm) {
    67         htmlheight = document.body.parentNode.clientHeight;
    68         bodyheight = document.body.clientHeight;
    69         var height = htmlheight > bodyheight ? htmlheight : bodyheight;
    70         jQuery(elm).height(height);
    71     }
    72     function getViewportDims() {
    73         var x,y;
    74         if (self.innerHeight) { // all except Explorer
    75             x = self.innerWidth;
    76             y = self.innerHeight;
    77         } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
    78             x = document.documentElement.clientWidth;
    79             y = document.documentElement.clientHeight;
    80         } else if (document.body) { // other Explorers
    81             x = document.body.clientWidth;
    82             y = document.body.clientHeight;
    83         }
    84         return new Array(x,y);
    85     }
    86     function dragChange(o) {
    87         var p = getViewportDims();
    88         var screenWidth = p[0];
    89         var screenHeight = p[1];
    90         var elWidth = parseInt( jQuery(o).css('width') );
    91         var elHeight = parseInt( jQuery(o).css('height') );
    92         var elLeft = parseInt( jQuery(o).css('left') );
    93         var elTop = parseInt( jQuery(o).css('top') );
    94         if ( screenWidth < ( parseInt(elLeft) + parseInt(elWidth) ) )
    95             jQuery(o).css('left', ( screenWidth - elWidth ) + 'px' );
    96         if ( screenHeight < ( parseInt(elTop) + parseInt(elHeight) ) )
    97             jQuery(o).css('top', ( screenHeight - elHeight ) + 'px' );
    98         if ( elLeft < 1 )
    99             jQuery(o).css('left', '1px');
    100         if ( elTop < 1 )
    101             jQuery(o).css('top', '1px');
    102     }
    103     function popControl(elm) {
    104         var x = ( document.body.clientWidth - controldims[elm]['width'] ) / 2;
    105         var y = ( document.body.parentNode.clientHeight - controldims[elm]['height'] ) / 2;
    106         jQuery(elm).css({display: 'block', width: controldims[elm]['width'] + 'px', height: controldims[elm]['height'] + 'px', position: 'absolute', right: x + 'px', top: y + 'px', zIndex: '1000' });
    107         jQuery(elm).attr('class','control');
    108         jQuery('#shadow').click(function() {unpopControl(elm);});
    109         window.onresize = function(){maxHeight('#shadow');dragChange(elm);};
    110         popShadow();
    111     }
    112     function popShadow() {
    113         maxHeight('#shadow');
    114         jQuery('#shadow').css({zIndex: '999', display: 'block'});
    115         jQuery('#shadow').fadeTo('fast', 0.2);
    116     }
    117     function unpopShadow() {
    118         jQuery('#shadow').fadeOut('fast', function() {jQuery('#shadow').hide()});
    119     }
    120     function unpopControl(el) {
    121         jQuery(el).attr('class','hidden');
    122         jQuery(el).hide();
    123         unpopShadow();
    124     }
    125     function serializeAll() {
    126     <?php $i = 0; foreach ( $wp_registered_sidebars as $index => $sidebar ) : $i++; ?>
    127         var serial<?php echo $i ?> = jQuery.SortSerialize('<?php echo $index ?>');
    128         jQuery('#<?php echo $index ?>order').attr('value',serial<?php echo $i ?>.hash.replace(/widgetprefix-/g, ''));
    129     <?php endforeach; ?>
    130     }
    131     function updateAll() {
    132         jQuery.map(cols, function(o) {
    133             if ( jQuery('#' + o + ' li').length )
    134                 jQuery('#'+o+'placemat span.handle').hide();
    135             else
    136                 jQuery('#'+o+'placemat span.handle').show();
    137         });
    138         resetDroppableHeights();
    139     }
    140     jQuery(document).ready( function() {
    141         updateAll();
    142         initWidgets();
    143     });
    144 // ]]>
    145 </script>
    146 <?php
    147 }
    148 add_action( 'admin_head', 'wp_widgets_admin_head' );
     8wp_enqueue_script( array( 'wp-lists', 'admin-widgets' ) );
     9
    14910do_action( 'sidebar_admin_setup' );
    150 
    151 function wp_widget_draggable( $name ) {
    152     global $wp_registered_widgets, $wp_registered_widget_controls;
    153 
    154     if ( !isset( $wp_registered_widgets[$name] ) ) {
    155         return;
    156     }
    157 
    158     $sanitized_name = sanitize_title( $wp_registered_widgets[$name]['id'] );
    159     $link_title = __( 'Configure' );
    160     $popper = ( isset( $wp_registered_widget_controls[$name] ) )
    161         ? ' <div class="popper" id="' . $sanitized_name . 'popper" title="' . $link_title . '">&#8801;</div>'
    162         : '';
    163 
    164     $output = '<li class="module" id="widgetprefix-%1$s"><span class="handle">%2$s</span></li>';
    165 
    166     printf( $output, $sanitized_name, $wp_registered_widgets[$name]['name'] . $popper );
    167 }
    16811
    16912$title = __( 'Widgets' );
    17013$parent_file = 'themes.php';
    17114
    172 require_once 'admin-header.php';
    173 
    174 if ( count( $wp_registered_sidebars ) < 1 ) {
     15// $sidebar = What sidebar are we editing?
     16if ( isset($_GET['sidebar']) && isset($wp_registered_sidebars[$_GET['sidebar']]) ) {
     17    $sidebar = attribute_escape( $_GET['sidebar'] );
     18} elseif ( is_array($wp_registered_sidebars) && !empty($wp_registered_sidebars) ) {
     19    // By default we look at the first defined sidebar
     20    $sidebar = array_shift( array_keys($wp_registered_sidebars) );
     21} else {
     22    // If no sidebars, die.
     23    require_once( 'admin-header.php' );
    17524?>
    176     <div class="wrap">
    177         <h2><?php _e( 'No Sidebars Defined' ); ?></h2>
    178 
     25
     26    <div class="error">
     27        <p><?php _e( 'No Sidebars Defined' ); ?></p>
     28    </div>
     29
     30    <div class="wrap">
    17931        <p><?php _e( 'You are seeing this message because the theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="http://automattic.com/code/widgets/themes/">follow these instructions</a>.' ); /* TODO: article on codex */; ?></p>
    18032    </div>
     33
    18134<?php
    182 
    183     require_once 'admin-footer.php';
     35    require_once( 'admin-footer.php' );
    18436    exit;
    18537}
    18638
     39// These are the widgets grouped by sidebar
    18740$sidebars_widgets = wp_get_sidebars_widgets();
    188 
    189 if ( empty( $sidebars_widgets ) ) {
     41if ( empty( $sidebars_widgets ) )
    19042    $sidebars_widgets = wp_get_widget_defaults();
     43
     44// for the sake of PHP warnings
     45if ( empty( $sidebars_widgets[$sidebar] ) )
     46    $sidebars_widgets[$sidebar] = array();
     47
     48$http_post = ( 'POST' == $_SERVER['REQUEST_METHOD'] );
     49
     50// We're updating a sidebar
     51if ( $http_post && isset($sidebars_widgets[$_POST['sidebar']]) ) {
     52
     53    /* Hack #1
     54     * The widget_control is overloaded.  It updates the widget's options AND echoes out the widget's HTML form.
     55     * Since we want to update before sending out any headers, we have to catchi it with an output buffer
     56     */
     57    ob_start();
     58        /* There can be multiple widgets of the same type, but the widget_control for that
     59         * widget type needs only be called once.
     60         */
     61        $already_done = array();
     62
     63        foreach ( $wp_registered_widget_controls as $name => $control ) {
     64            if ( in_array( $control['callback'], $already_done ) )
     65                continue;
     66
     67            if ( is_callable( $control['callback'] ) )
     68                call_user_func_array( $control['callback'], $control['params'] );
     69        }
     70    ob_end_clean();
     71
     72    // Prophylactic.  Take out empty ids.
     73    foreach ( (array) $_POST['widget-id'] as $key => $val )
     74        if ( !$val )
     75            unset($_POST['widget-id'][$key]);
     76
     77    // Reset the key numbering and stare
     78    $new_sidebar = array_values( $_POST['widget-id'] );
     79    $sidebars_widgets[$_POST['sidebar']] = $new_sidebar;
     80    wp_set_sidebars_widgets( $sidebars_widgets );
     81
     82    // Re-register just in case
     83    wp_widgets_init();
     84
     85    wp_redirect( add_query_arg( 'message', 'updated' ) );
     86    exit;
    19187}
    19288
    193 if ( isset( $_POST['action'] ) ) {
    194     check_admin_referer( 'widgets-save-widget-order' );
    195 
    196     switch ( $_POST['action'] ) {
    197         case 'default' :
    198             $sidebars_widgets = wp_get_widget_defaults();
    199             wp_set_sidebars_widgets( $sidebars_widgets );
    200         break;
    201 
    202         case 'save_widget_order' :
    203             $sidebars_widgets = array();
    204 
    205             foreach ( $wp_registered_sidebars as $index => $sidebar ) {
    206                 $postindex = $index . 'order';
    207 
    208                 parse_str( $_POST[$postindex], $order );
    209 
    210                 $new_order = $order[$index];
    211 
    212                 if ( is_array( $new_order ) ) {
    213                     foreach ( $new_order as $sanitized_name ) {
    214                         foreach ( $wp_registered_widgets as $name => $widget ) {
    215                             if ( $sanitized_name == $widget['id'] ) {
    216                                 $sidebars_widgets[$index][] = $name;
    217                             }
    218                         }
    219                     }
    220                 }
    221             }
    222 
    223             wp_set_sidebars_widgets( $sidebars_widgets );
    224         break;
     89
     90
     91
     92// What widget (if any) are we editing
     93$edit_widget = -1;
     94
     95$query_args = array('add', 'remove', 'key', 'edit', '_wpnonce', 'message' );
     96
     97if ( isset($_GET['add']) && $_GET['add'] ) {
     98    // Add to the end of the sidebar
     99    if ( isset($wp_registered_widgets[$_GET['add']]) ) {
     100        check_admin_referer( "add-widget_$_GET[add]" );
     101        $sidebars_widgets[$sidebar][] = $_GET['add'];
     102        wp_set_sidebars_widgets( $sidebars_widgets );
    225103    }
     104    wp_redirect( remove_query_arg( $query_args ) );
     105    exit;
     106} elseif ( isset($_GET['remove']) && $_GET['remove'] && isset($_GET['key']) && is_numeric($_GET['key']) ) {
     107    // Remove from sidebar the widget of type $_GET['remove'] and in position $_GET['key']
     108    $key = (int) $_GET['key'];
     109    if ( -1 < $key && ( $keys = array_keys($sidebars_widgets[$sidebar], $_GET['remove']) ) && in_array($key, $keys) ) {
     110        check_admin_referer( "remove-widget_$_GET[remove]" );
     111        unset($sidebars_widgets[$sidebar][$key]);
     112        $sidebars_widgets[$sidebar] = array_values($sidebars_widgets[$sidebar]);
     113        wp_set_sidebars_widgets( $sidebars_widgets );
     114    }
     115    wp_redirect( remove_query_arg( $query_args ) );
     116    exit;
     117} elseif ( isset($_GET['edit']) && $_GET['edit'] && isset($_GET['key']) && is_numeric($_GET['key']) ) {
     118    // Edit widget of type $_GET['edit'] and position $_GET['key']
     119    $key = (int) $_GET['key'];
     120    if ( -1 < $key && ( $keys = array_keys($sidebars_widgets[$sidebar], $_GET['edit']) ) && in_array($key, $keys) )
     121        $edit_widget = $key;
    226122}
    227123
    228 ksort( $wp_registered_widgets );
    229 
    230 $inactive_widgets = array();
    231 
    232 foreach ( $wp_registered_widgets as $name => $widget ) {
    233     $is_active = false;
    234 
    235     foreach ( $wp_registered_sidebars as $index => $sidebar ) {
    236         if ( is_array( $sidebars_widgets[$index] ) && in_array( $name, $sidebars_widgets[$index] ) ) {
    237             $is_active = true;
    238             break;
    239         }
    240     }
    241 
    242     if ( !$is_active ) {
    243         $inactive_widgets[] = $name;
    244     }
    245 }
    246 
    247 $containers = array( 'palette' );
    248 
    249 foreach ( $wp_registered_sidebars as $index => $sidebar ) {
    250     $containers[] = $index;
    251 }
    252 
    253 $c_string = '';
    254 
    255 foreach ( $containers as $container ) {
    256     $c_string .= '"' . $container . '",';
    257 }
    258 
    259 $c_string = substr( $c_string, 0, -1 );
    260 
    261 if ( isset( $_POST['action'] ) ) {
    262 ?>
    263     <div class="fade updated" id="message">
    264         <p><?php printf( __( 'Sidebar updated. <a href="%s">View site &raquo;</a>' ), get_bloginfo( 'url' ) . '/' ); ?></p>
    265     </div>
    266 <?php
    267 }
    268 ?>
    269     <div class="wrap">
    270         <h2><?php _e( 'Sidebar Arrangement' ); ?></h2>
    271 
    272         <p><?php _e( 'You can drag and drop widgets onto your sidebar below.' ); ?></p>
    273 
    274         <form id="sbadmin" method="post" onsubmit="serializeAll();">
    275             <p class="submit">
    276                 <input type="submit" value="<?php _e( 'Save Changes &raquo;' ); ?>" />
     124// Total number of registered sidebars
     125$sidebar_widget_count = count($sidebars_widgets[$sidebar]);
     126
     127// This is sort of lame since "widget" won't be converted to "widgets" in the JS
     128if ( 1 < $sidebars_count = count($wp_registered_sidebars) )
     129    $sidebar_info_text = __ngettext( 'You are using %1$s widget in the "%2$s" sidebar.', 'You are using %1$s widgets in the "%2$s" sidebar.', $sidebar_widget_count );
     130else
     131    $sidebar_info_text = __ngettext( 'You are using %1$s widget in the sidebar.', 'You are using %1$s widgets in the sidebar.', $sidebar_widget_count );
     132
     133
     134$sidebar_info_text = sprintf( wp_specialchars( $sidebar_info_text ), "<span id='widget-count'>$sidebar_widget_count</span>", $wp_registered_sidebars[$sidebar]['name'] );
     135
     136$page = isset($_GET['apage']) ? abs( (int) $_GET['apage'] ) : 1;
     137
     138/* TODO: Paginate widgets list
     139$page_links = paginate_links( array(
     140    'base'    => add_query_arg( 'apage', '%#%' ),
     141    'format'  => '',
     142    'total'   => ceil(($total = 105 )/ 10),
     143    'current' => $page
     144));
     145*/
     146$page_links = false;
     147
     148// Unsanitized!
     149$widget_search = isset($_GET['s']) ? $_GET['s'] : false;
     150
     151// Not entirely sure what all should be here
     152$show_values = array(
     153    ''       => $widget_search ? __( 'Show any widgets' ) : __( 'Show all widgets' ),
     154    'unused' => __( 'Show unused widgets' ),
     155    'used'   => __( 'Show used widgets' )
     156);
     157
     158$show = isset($_GET['show']) && isset($show_values[$_GET['show']]) ? attribute_escape( $_GET['show'] ) : false;
     159
     160
     161$messages = array(
     162    'updated' => __('Changes saved.')
     163);
     164
     165require_once( 'admin-header.php' );
     166
     167if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) : ?>
     168
     169<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
     170
     171<?php endif; ?>
     172
     173<div class="wrap">
     174
     175    <form id="widgets-filter" action="" method="get">
     176
     177    <h2><?php _e( 'Widgets' ); ?></h2>
     178    <p id="widget-search">
     179        <input type="text" id="widget-search-input" name="s" value="<?php echo attribute_escape( $widget_search ); ?>" />
     180        <input type="submit" value="<?php _e( 'Search Widgets' ); ?>" />
     181    </p>
     182
     183    <div class="widget-liquid-left-holder">
     184    <div id="available-widgets-filter" class="widget-liquid-left">
     185        <h3><?php printf( __('Available Widgets %s'), '<a href="#help:avaliable-widgets" class="wp-context-help">?</a>' ); ?></h3>
     186        <p>
     187            <select name="show">
     188<?php foreach ( $show_values as $show_value => $show_text ) : $show_value = attribute_escape( $show_value ); ?>
     189                <option value='<?php echo $show_value; ?>'<?php selected( $show_value, $show ); ?>><?php echo wp_specialchars( $show_text ); ?></option>
     190<?php endforeach; ?>
     191            </select>
     192            <input type="submit" value="<?php _e('Show' ); ?>" />
     193        </p>
     194<?php if ( $page_links ) : ?>
     195        <p class="pagenav">
     196            <?php echo $page_links; ?>
     197
     198        </p>
     199<?php endif; ?>
     200    </div>
     201    </div>
     202
     203    <div id="available-sidebars" class="widget-liquid-right">
     204        <h3><?php printf( __('Current Widgets %s'), '<a href="#help:current-widgets" class="wp-context-help">?</a>' ); ?></h3>
     205
     206<?php if ( 1 < $sidebars_count ) : ?>
     207
     208        <p>
     209            <select id="sidebar-selector" name="sidebar">
     210<?php foreach ( $wp_registered_sidebars as $sidebar_id => $registered_sidebar ) : $sidebar_id = attribute_escape( $sidebar_id ); ?>
     211                <option value='<?php echo $sidebar_id; ?>'<?php selected( $sidebar_id, $sidebar ); ?>><?php echo wp_specialchars( $registered_sidebar['name'] ); ?></option>
     212<?php endforeach; ?>
     213            </select>
     214            <input type="submit" value="<?php _e('Go' ); ?>" />
     215        </p>
     216
     217<?php endif; ?>
     218
     219    </div>
     220
     221    </form>
     222
     223    <div id="widget-content" class="widget-liquid-left-holder">
     224
     225        <div id="available-widgets" class="widget-liquid-left">
     226
     227            <?php wp_list_widgets( $show, $widget_search ); // This lists all the widgets for the query ( $show, $search ) ?>
     228
     229<?php if ( $page_links ) : ?>
     230            <p class="pagenav">
     231                <?php echo $page_links; ?>
     232
    277233            </p>
    278             <div id="zones">
    279             <?php
    280                 foreach ( $wp_registered_sidebars as $index => $sidebar ) {
    281             ?>
    282                 <input type="hidden" id="<?php echo $index; ?>order" name="<?php echo $index; ?>order" value="" />
    283 
    284                 <div class="dropzone">
    285                     <h3><?php echo $sidebar['name']; ?></h3>
    286 
    287                     <div id="<?php echo $index; ?>placemat" class="placemat">
    288                         <span class="handle">
    289                             <h4><?php _e( 'Default Sidebar' ); ?></h4>
    290                             <?php _e( 'Your theme will display its usual sidebar when this box is empty. Dragging widgets into this box will replace the usual sidebar with your customized sidebar.' ); ?>
    291                         </span>
    292                     </div>
    293 
    294                     <ul id="<?php echo $index; ?>">
    295                     <?php
    296                         if ( is_array( $sidebars_widgets[$index] ) ) {
    297                             foreach ( $sidebars_widgets[$index] as $name ) {
    298                                 wp_widget_draggable( $name );
    299                             }
    300                         }
    301                     ?>
    302                     </ul>
    303                 </div>
    304             <?php
    305                 }
    306             ?>
    307 
    308             </div>
    309 
    310             <div id="palettediv">
    311                 <h3><?php _e( 'Available Widgets' ); ?></h3>
    312 
    313                 <ul id="palette">
    314                 <?php
    315                     foreach ( $inactive_widgets as $name ) {
    316                         wp_widget_draggable( $name );
    317                     }
    318                 ?>
    319                 </ul>
    320             </div>
    321 
    322             <script type="text/javascript">
    323             // <![CDATA[
    324                 jQuery(document).ready(function(){
    325             <?php foreach ( $containers as $container ) { ?>
    326                     jQuery('ul#<?php echo $container; ?>').Sortable({
    327                         accept: 'module', activeclass: 'activeDraggable', opacity: 0.8, revert: true, onStop: updateAll
    328                     });
    329             <?php } ?>
    330                 });
    331             // ]]>
    332             </script>
    333 
    334             <p class="submit">
    335             <?php wp_nonce_field( 'widgets-save-widget-order' ); ?>
    336                 <input type="hidden" name="action" id="action" value="save_widget_order" />
    337                 <input type="submit" value="<?php _e( 'Save Changes &raquo;' ); ?>" />
    338             </p>
    339 
    340             <div id="controls">
    341             <?php foreach ( $wp_registered_widget_controls as $name => $widget ) { ?>
    342                 <div class="hidden" id="<?php echo $widget['id']; ?>control">
    343                     <span class="controlhandle"><?php echo $widget['name']; ?></span>
    344                     <span id="<?php echo $widget['id']; ?>closer" class="controlcloser">&#215;</span>
    345                     <div class="controlform">
    346                     <?php call_user_func_array( $widget['callback'], $widget['params'] ); ?>
    347                     </div>
    348                 </div>
    349             <?php } ?>
    350             </div>
    351         </form>
    352 
    353         <br class="clear" />
    354     </div>
    355 
    356     <div id="shadow"> </div>
    357 
    358     <?php do_action( 'sidebar_admin_page' ); ?>
    359 
    360 <?php require_once 'admin-footer.php'; ?>
     234<?php endif; ?>
     235
     236        </div>
     237    </div>
     238
     239    <form id="widget-controls" action="" method="post">
     240
     241    <div id="current-widgets-head" class="widget-liquid-right">
     242
     243        <div id="sidebar-info">
     244            <p><?php echo $sidebar_info_text; ?></p>
     245            <p><?php _e( 'Add more from the Available Widgets section.' ); ?></p>
     246        </div>
     247
     248    </div>
     249
     250    <div id="current-widgets" class="widget-liquid-right">
     251        <input type="hidden" id='sidebar' name='sidebar' value="<?php echo $sidebar; ?>" />
     252
     253        <div id="current-sidebar">
     254
     255            <?php wp_list_widget_controls( $sidebars_widgets[$sidebar], $edit_widget ); // Show the control forms for each of the widgets in this sidebar ?>
     256
     257        </div>
     258    </div>
     259
     260    <p class="submit">
     261        <input type="hidden" id="generated-time" name="generated-time" value="<?php echo time(); ?>" />
     262        <input type="submit" name="save-widgets" value="<?php _e( 'Save Changes' ); ?>" />
     263    </p>
     264
     265    </form>
     266
     267</div>
     268
     269<?php do_action( 'sidebar_admin_page' ); ?>
     270
     271<?php require_once( 'admin-footer.php' ); ?>
     272
Note: See TracChangeset for help on using the changeset viewer.