Make WordPress Core

Changeset 11160


Ignore:
Timestamp:
05/03/2009 05:27:13 AM (16 years ago)
Author:
azaozz
Message:

Widgets UI styling, see #9511

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/colors-classic.css

    r11146 r11160  
    427427}
    428428
    429 div#available-widgets-filter,
    430429.commentlist li {
    431430    border-bottom-color: #ccc;
     
    609608
    610609.widget,
     610#widget-list .widget-top,
    611611.postbox,
    612612#titlediv,
     
    981981#post-status-info,
    982982#titlediv #title,
    983 .editwidget .widget-control {
     983.editwidget .widget-inside {
    984984    border-color: #dfdfdf;
    985985}
     
    16051605}
    16061606
    1607 div.widgets-holder-wrap {
    1608     background-color: #f1f1f1;
     1607div.widgets-sortables,
     1608#widgets-left .inactive {
     1609    background-color: #f1f1f1;
    16091610    border-color: #ddd;
     1611}
     1612
     1613#available-widgets .widget-holder {
     1614    background-color: #fff;
     1615    border-color: #ddd;
     1616}
     1617
     1618#widgets-left h3.sidebar-name {
     1619    background-color: #aaa;
     1620    background-image: url(../images/ed-bg-vs.gif);
     1621    text-shadow: #FFFFFF 0 -1px 0;
     1622    border-color: #dfdfdf;
     1623}
     1624
     1625#widgets-right h3.sidebar-name {
     1626    background-image: url(../images/fav.png);
     1627    text-shadow: #3f3f3f 0 -1px 0;
     1628    background-color: #636363;
     1629    border-color: #636363;
     1630    color: #fff;
    16101631}
    16111632
  • trunk/wp-admin/css/colors-fresh.css

    r11146 r11160  
    11html {
    22    background-color: #f9f9f9;
     3}
     4
     5* html input,
     6* html .widget {
     7    border-color: #dfdfdf;
     8}
     9
     10textarea,
     11input,
     12select {
     13    border-color: #DFDFDF;
     14}
     15
     16kbd,
     17code {
     18    background: #eaeaea;
     19}
     20
     21input[readonly] {
     22    background-color: #eee;
    323}
    424
     
    2848body > #upload-menu {
    2949    border-bottom-color: #fff;
    30 }
    31 
    32 kbd, code {
    33     background: #eaeaea;
    3450}
    3551
     
    403419}
    404420
    405 div#available-widgets-filter,
    406421.commentlist li {
    407422    border-bottom-color: #ccc;
     
    606621
    607622.widget,
     623#widget-list .widget-top,
    608624.postbox,
    609625#titlediv,
     
    948964#post-status-info,
    949965#titlediv #title,
    950 .editwidget .widget-control {
     966.editwidget .widget-inside {
    951967    border-color: #dfdfdf;
    952968}
     
    15501566}
    15511567
    1552 input[readonly] {
    1553     background-color: #eee;
    1554 }
    1555 
    15561568.popular-tags,
    15571569.feature-filter {
     
    15681580}
    15691581
    1570 div.widgets-holder-wrap {
    1571     background-color: #F1F1F1;
    1572     border-color: #DDDDDD;
     1582div.widgets-sortables,
     1583#widgets-left .inactive {
     1584    background-color: #f1f1f1;
     1585    border-color: #ddd;
     1586}
     1587
     1588#available-widgets .widget-holder {
     1589    background-color: #fff;
     1590    border-color: #ddd;
     1591}
     1592
     1593#widgets-left h3.sidebar-name {
     1594    background-color: #aaa;
     1595    background-image: url(../images/ed-bg.gif);
     1596    text-shadow: #FFFFFF 0 -1px 0;
     1597    border-color: #dfdfdf;
     1598}
     1599
     1600#widgets-right h3.sidebar-name {
     1601    background-image: url(../images/fav.png);
     1602    text-shadow: #3f3f3f 0 -1px 0;
     1603    background-color: #636363;
     1604    border-color: #636363;
     1605    color: #fff;
    15731606}
    15741607
     
    15761609    color: #d54e21;
    15771610}
    1578 
    1579 textarea,
    1580 input,
    1581 select {
    1582     border-color: #DFDFDF;
    1583 }
    1584 
    1585 * html input,
    1586 * html .widget {
    1587     border-color: #dfdfdf;
    1588 }
  • trunk/wp-admin/css/widgets.css

    r11133 r11160  
     1html,
     2body {
     3    min-width: 950px;
     4}
     5
    16/* 2 column liquid layout */
    27div.widget-liquid-left {
     
    813
    914div#widgets-left {
    10     margin-right: 335px;
     15    margin-left: 5px;
     16    margin-right: 325px;
     17}
     18
     19div#widgets-right {
     20    width: 285px;
     21    margin: 0 auto;
    1122}
    1223
     
    1425    float: right;
    1526    clear: right;
    16     width: 320px;
    17 }
    18 
    19 .widgets-sortables li {
    2027    width: 300px;
    21     margin: 15px 0 18px;
     28}
     29
     30.widget-liquid-right .widget,
     31#wp_inactive_widgets .widget {
     32    width: 250px;
     33    margin: 0 auto 20px;
    2234    position: relative;
    2335}
    2436
    25 #widgets-left .widgets-sortables li,
    26 #widgets-left #widget-list li {
    27     float: left;
    28     margin: 0 15px 18px 3px;
    29     width: 300px;
    30 }
    31 
    32 .widget-placeholder {
    33     border-width: 1px;
    34     border-style: dashed;
    35     margin-bottom: 20px;
    36     height: 25px;
    37     width: 298px;
    38 }
    39 
    40 div.widgets-holder-wrap {
    41     padding: 8px 8px 0;
    42     margin: 12px 0;
     37#wp_inactive_widgets .widget {
     38    margin: 0 10px 20px;
     39    float: left;
     40}
     41
     42.widget-liquid-right .sidebar-name {
     43    width: 256px;
     44}
     45
     46h3.sidebar-name {
     47    background-repeat: repeat-x;
     48    background-position: 0 0;
     49    margin: 0;
     50    cursor: pointer;
     51    font-size: 13px;
     52    padding: 5px 12px;
    4353    border-width: 1px;
    4454    border-style: solid;
    45     -moz-border-radius: 6px;
     55    -moz-border-radius-topleft: 8px;
     56    -moz-border-radius-topright: 8px;
     57    -webkit-border-top-right-radius: 8px;
     58    -webkit-border-top-left-radius: 8px;
     59    -khtml-border-top-right-radius: 8px;
     60    -khtml-border-top-left-radius: 8px;
     61    border-top-right-radius: 8px;
     62    border-top-left-radius: 8px;
     63}
     64
     65.js .closed h3.sidebar-name {
     66    -moz-border-radius-bottomleft: 8px;
     67    -moz-border-radius-bottomright: 8px;
     68    -webkit-border-bottom-right-radius: 8px;
     69    -webkit-border-bottom-left-radius: 8px;
     70    -khtml-border-bottom-right-radius: 8px;
     71    -khtml-border-bottom-left-radius: 8px;
     72    border-bottom-right-radius: 8px;
     73    border-bottom-left-radius: 8px;
     74}
     75
     76.widget-liquid-right .widgets-sortables,
     77#widgets-left .widget-holder {
     78    border-width: 0 1px 1px;
     79    border-style: none solid solid;
     80    -moz-border-radius-bottomleft: 8px;
     81    -moz-border-radius-bottomright: 8px;
     82    -webkit-border-bottom-right-radius: 8px;
     83    -webkit-border-bottom-left-radius: 8px;
     84    -khtml-border-bottom-right-radius: 8px;
     85    -khtml-border-bottom-left-radius: 8px;
     86    border-bottom-right-radius: 8px;
     87    border-bottom-left-radius: 8px;
     88}
     89
     90.js .closed .widgets-sortables,
     91.js .closed .widget-holder {
     92    display: none;
     93}
     94
     95.widget-liquid-right .widgets-sortables {
     96    padding: 15px 0 0;
     97    width: 280px;
     98}
     99
     100#available-widgets .widget-holder {
     101    padding: 15px 5px 0;
     102}
     103
     104#wp_inactive_widgets {
     105    padding: 5px 5px 0;
     106}
     107
     108#widget-list .widget {
     109    width: 250px;
     110    margin: 0 10px 15px;
     111    border: 0 none;
     112    float: left;
     113}
     114
     115#widget-list .widget-description {
     116    padding: 5px 8px;
     117}
     118
     119#widget-list .widget-top {
     120    border-width: 1px;
     121    border-style: solid;
     122    -moz-border-radius: 6px;
    46123    -khtml-border-radius: 6px;
    47124    -webkit-border-radius: 6px;
     
    49126}
    50127
     128.widget-placeholder {
     129    border-width: 1px;
     130    border-style: dashed;
     131    margin: 0 auto 20px;
     132    height: 26px;
     133    width: 250px;
     134}
     135
     136#wp_inactive_widgets .widget-placeholder {
     137    margin: 0 10px 20px;
     138    float: left;
     139}
     140
     141div.widgets-holder-wrap {
     142    padding: 0;
     143    margin: 10px 0 20px;
     144}
     145
    51146#widgets-left #available-widgets {
    52147    background-color: transparent;
    53148    border: 0 none;
    54 }
    55 
    56 div#available-widgets-filter {
    57     border-bottom-width: 1px;
    58     border-bottom-style: solid;
    59149}
    60150
     
    73163
    74164.widget-top .widget-title {
    75     margin-right: 30px;
    76165    padding: 7px 9px;
    77166}
     
    81170}
    82171
    83 .widget-title-action a {
     172a.widget-action {
    84173    display: block;
    85174    width: 24px;
     
    87176}
    88177
    89 .widget-top:hover .widget-title-action a {
     178#available-widgets a.widget-action {
     179    display: none;
     180}
     181
     182.widget-top:hover a.widget-action {
    90183    background: url("../images/menu-bits.gif") no-repeat scroll 0 -110px;
    91184}
    92185
    93 .widget .widget-inside {
     186.widget .widget-inside,
     187.widget .widget-description {
    94188    padding: 15px;
    95189    font-size: 11px;
    96     display: none;
    97 }
    98 
    99 .widget-control,
     190    line-height: 16px;
     191}
     192
     193.widget-inside,
    100194.widget-description {
    101195    display: none;
    102196}
    103197
    104 #available-widgets .widget-description,
    105 .widget-liquid-right .widget-control,
    106 #wp_inactive_widgets .widget-control {
    107     display: block;
    108 }
    109 
    110 .widget .widget-control p {
     198#available-widgets .widget-description {
     199    display: block;
     200}
     201
     202.widget .widget-inside p {
    111203    margin: 0 0 1em;
    112204    padding: 0;
     
    118210}
    119211
    120 .sidebar-name {
    121     margin: 0 0 12px;
    122     padding: 6px;
    123     cursor: pointer;
    124 }
    125 
    126212.widgets-sortables {
    127     min-height: 50px;
     213    min-height: 90px;
    128214}
    129215
     
    149235
    150236.widget-control-edit {
    151     font-size: 10px;
     237    display: block;
     238    font-size: 11px;
    152239    font-weight: normal;
    153 }
    154 
    155 .editwidget .widget-control {
     240    line-height: 24px;
     241    padding: 0 8px 0 0;
     242}
     243
     244a.widget-control-edit {
     245    text-decoration: none;
     246}
     247
     248.widget-control-edit .add,
     249.widget-control-edit .edit {
     250    display: none;
     251}
     252
     253#available-widgets .widget-control-edit .add {
     254    display: block;
     255}
     256
     257#widgets-right .widget-control-edit .edit,
     258#wp_inactive_widgets .widget-control-edit .edit {
     259    display: block;
     260}
     261
     262.editwidget {
     263    margin: 0 auto 15px;
     264}
     265
     266.editwidget .widget-inside {
    156267    display: block;
    157268    border-width: 1px;
     
    164275}
    165276
    166 .widget-position table {
    167     width: 100%;
    168     margin-top: 12px;
    169 }
    170 
    171 .widget-position table td {
    172     height: 3em;
    173     line-height: 3em;
    174     vertical-align: middle;
    175 }
    176 
    177 #wp_inactive_widgets .sidebar-name {
    178     margin: 0;
    179     padding: 2px 0;
    180 }
    181 
    182 #wp_inactive_widgets p.description {
    183     margin: 0 0 15px;
    184 }
     277#widgets-left p.description {
     278    margin: 5px 15px 8px;
     279}
     280
     281.widget-position {
     282    margin-top: 8px;
     283}
     284
     285.inactive {
     286    padding-top: 2px;
     287}
  • trunk/wp-admin/includes/widgets.php

    r11155 r11160  
    2020    global $wp_registered_widgets, $sidebars_widgets, $wp_registered_widget_controls;
    2121
    22     $no_widgets_shown = true;
    23     $already_shown = array(); ?>
    24 
    25     <ul id="widget-list">
    26 <?php
    27     foreach ( $wp_registered_widgets as $name => $widget ) {
    28         if ( in_array( $widget['callback'], $already_shown ) ) // We already showed this multi-widget
     22    $done = array();
     23    $sort = array_keys($wp_registered_widgets);
     24    natcasesort($sort); ?>
     25
     26    <div class="widget-holder">
     27    <div id="widget-list">
     28<?php
     29    foreach ( $sort as $val ) {
     30        $widget = $wp_registered_widgets[$val];
     31        if ( in_array( $widget['callback'], $done, true ) ) // We already showed this multi-widget
    2932            continue;
    3033
    3134        $sidebar = is_active_widget( $widget['callback'], $widget['id'] );
     35        $done[] = $widget['callback'];
    3236
    3337        if ( ! isset( $widget['params'][0] ) )
    3438            $widget['params'][0] = array();
    35 
    36         $already_shown[] = $widget['callback'];
    37         $no_widgets_shown = false;
    3839
    3940        $args = array( 'widget_id' => $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template' );
     
    5253        $args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $args, 1 => $widget['params'][0] ) );
    5354        call_user_func_array( 'wp_widget_control', $args );
    54     }
    55 
    56     if ( $no_widgets_shown )
    57       echo '<li>' . __( 'No matching widgets' ) . "</li>\n"; ?>
    58     </ul>
     55    } ?>
     56    </div>
     57    <br class='clear' />
     58    </div>
    5959<?php
    6060}
     
    6767 * @param string $sidebar
    6868 */
    69 function wp_list_widget_controls( $sidebar, $hide = false ) {
     69function wp_list_widget_controls( $sidebar ) {
    7070    add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' );
    71 ?>
    72 
    73     <ul class="widgets-sortables<?php echo $hide ? ' hide-if-js' : ''; ?>">
    74     <?php dynamic_sidebar( $sidebar ); ?>
    75     </ul>
    76 
    77 <?php
     71
     72    echo "\t<div id='$sidebar' class='widgets-sortables'>\n";
     73    dynamic_sidebar( $sidebar );
     74    echo "\t</div>\n";
    7875}
    7976
     
    9592    $hidden = isset($params[0]['_hide']) ? ' style="display:none;"' : '';
    9693
    97     $params[0]['before_widget'] = "<li id='widget-${i}_$id' class='widget'$hidden>";
    98     $params[0]['after_widget'] = "</li>";
     94    $params[0]['before_widget'] = "<div id='widget-${i}_$id' class='widget'$hidden>";
     95    $params[0]['after_widget'] = "</div>";
    9996    $params[0]['before_title'] = "%BEG_OF_TITLE%"; // deprecated
    10097    $params[0]['after_title'] = "%END_OF_TITLE%"; // deprecated
     
    172169    <div class="widget-top">
    173170    <div class="widget-title-action">
    174         <a class="widget-action widget-control-edit" href="<?php echo clean_url( add_query_arg( $query_arg ) ); ?>"></a>
     171        <a class="widget-action hide-if-no-js" href="#available-widgets"></a>
     172        <a class="widget-control-edit hide-if-js" href="<?php echo clean_url( add_query_arg( $query_arg ) ); ?>"><span class="edit"><?php _e('Edit'); ?></span><span class="add"><?php _e('Add'); ?></span></a>
    175173    </div>
    176174    <div class="widget-title"><h4><?php echo $widget_title ?></h4></div>
     
    179177    <div class="widget-inside">
    180178    <form action="" method="post">
    181     <div class="widget-control">
    182179<?php
    183180    if ( isset($control['callback']) )
     
    201198        <br class="clear" />
    202199    </div>
    203     </div>
    204200    </form>
     201    </div>
    205202
    206203    <div class="widget-description">
    207204<?php echo ( $widget_description = wp_widget_description($widget_id) ) ? "$widget_description\n" : "$widget_title\n"; ?>
    208205    </div>
    209     </div>
    210206<?php
    211207    echo $sidebar_args['after_widget'];
  • trunk/wp-admin/js/widgets.dev.js

    r11093 r11160  
    55wpWidgets = {
    66    init : function() {
    7         var rem;
    8         $('h3.sidebar-name').click(function(){
     7        var rem, hr = $('#available-widgets .widget-holder').height(), firstsb = $('#widgets-right .widgets-holder-wrap .widgets-sortables:first'), hl = firstsb.height();
     8
     9        $('#widgets-right h3.sidebar-name').click(function(){
    910            var c = $(this).siblings('.widgets-sortables');
    1011            if ( c.is(':visible') ) {
    1112                c.hide().sortable('disable');
     13                $(this).parent().addClass('closed');
    1214            } else {
    1315                c.show().sortable('enable').sortable('refresh');
     16                $(this).parent().removeClass('closed');
    1417            }
    15             $(this).siblings('#widget-list').toggle();
    1618        });
    17         this.addEvents();
     19       
     20        $('#widgets-left h3.sidebar-name').click(function(){
     21            if ( $(this).siblings('.widget-holder').is(':visible') ) {
     22                $(this).parent().addClass('closed');
     23            } else {
     24                $(this).parent().removeClass('closed');
     25            }
     26        });
     27       
     28        if ( hr > hl )
     29            firstsb.css('minHeight', hr + 'px');
     30       
     31        this.addEvents();
    1832        $('.widget-error').parents('.widget').find('a.widget-action').click();
    1933
     
    2438            helper: 'clone',
    2539            zIndex: 5,
    26             start: function() {
     40            start: function(e,ui) {
    2741                wpWidgets.fixWebkit(1);
     42                ui.helper.find('.widget-description').hide();
    2843            },
    2944            stop: function(e,ui) {
     
    4964            },
    5065            stop: function(e,ui) {
    51                 var add = ui.item.find('input.add_new').val(), n = ui.item.find('input.multi_number').val(), id = ui.item.attr('id'), sb = $(this).parent().attr('id');
     66                var add = ui.item.find('input.add_new').val(), n = ui.item.find('input.multi_number').val(), id = ui.item.attr('id'), sb = $(this).attr('id');
    5267                ui.item.css({'marginLeft':'','width':''});
    5368
     
    5772                        ui.item.attr( 'id', id.replace(/__i__/g, n) );
    5873                        n++;
    59                         $('li#' + id).find('input.multi_number').val(n);
     74                        $('div#' + id).find('input.multi_number').val(n);
    6075                    } else if ( 'single' == add ) {
    6176                        ui.item.attr( 'id', 'new-' + id );
    62                         rem = 'li#' + id;
     77                        rem = 'div#' + id;
    6378                    }
    6479                    wpWidgets.addEvents(ui.item);
     
    7994
    8095    saveOrder : function(sb) {
    81         $('#' + sb + ' .ajax-feedback').css('visibility', 'visible');
     96        $('#' + sb).parents('.widgets-holder-wrap').find('.ajax-feedback').css('visibility', 'visible');
    8297
    8398        var a = {
     
    88103
    89104        $('.widgets-sortables').each( function() {
    90             a['sidebars[' + $(this).parent().attr('id') + ']'] = $(this).sortable('toArray').join(',');
     105            a['sidebars[' + $(this).attr('id') + ']'] = $(this).sortable('toArray').join(',');
    91106        });
    92107
     
    97112
    98113    save : function(data, sb, del, t) {
    99         $('#' + sb + ' .ajax-feedback').css('visibility', 'visible');
     114        $('#' + sb).parents('.widgets-holder-wrap').find('.ajax-feedback').css('visibility', 'visible');
    100115
    101116        var a = {
     
    117132
    118133            if ( del ) {
    119                 $(t).parents('li.widget').slideUp('normal', function(){ $(this).remove(); });
     134                $(t).parents('.widget').slideUp('normal', function(){ $(this).remove(); });
    120135                if ( !a.widget_number ) {
    121136                    id = a['widget-id'];
    122137                    $('#available-widgets .widget-id').each(function(){
    123138                        if ( $(this).val() == id )
    124                             $(this).parents('li.widget').show();
     139                            $(this).parents('.widget').show();
    125140                    });
    126141                }
    127142            } else {
    128                 $(t).parents('.widget-inside').slideUp('normal', function(){ $(this).parents('li.widget').css({'width':'','marginLeft':''}); });
     143                $(t).parents('.widget-inside').slideUp('normal', function(){ $(this).parents('.widget').css({'width':'','marginLeft':''}); });
    129144            }
    130145        });
     
    144159            var w = parseInt( $(this).parents('.widget').find('.widget-width').val(), 10 ), css = {}, inside = $(this).parents('.widget-top').siblings('.widget-inside');
    145160            if ( inside.is(':hidden') ) {
    146                 if ( w > 270 && inside.parents('.widgets-sortables').length ) {
     161                if ( w > 250 && inside.parents('.widgets-sortables').length ) {
    147162                    css['width'] = w + 30 + 'px';
    148163                    if ( inside.parents('.widget-liquid-right').length )
    149                         css['marginLeft'] = 270 - w + 'px';
     164                        css['marginLeft'] = 234 - w + 'px';
    150165                    inside.parents('.widget').css(css);
    151166                }
     
    157172        });
    158173        $('.widget-control-save', sc).click(function(){
    159             wpWidgets.save( $(this).parents('form').serializeArray(), $(this).parents('.widgets-holder-wrap').attr('id'), 0, this );
     174            wpWidgets.save( $(this).parents('form').serializeArray(), $(this).parents('.widgets-sortables').attr('id'), 0, this );
    160175            return false;
    161176        });
    162177        $('.widget-control-remove', sc).click(function(){
    163             wpWidgets.save( $(this).parents('form').serializeArray(), $(this).parents('.widgets-holder-wrap').attr('id'), 1, this );
     178            wpWidgets.save( $(this).parents('form').serializeArray(), $(this).parents('.widgets-sortables').attr('id'), 1, this );
    164179            return false;
    165180        });
  • trunk/wp-admin/js/widgets.js

    r11093 r11160  
    1 var wpWidgets;(function(a){wpWidgets={init:function(){var b;a("h3.sidebar-name").click(function(){var d=a(this).siblings(".widgets-sortables");if(d.is(":visible")){d.hide().sortable("disable")}else{d.show().sortable("enable").sortable("refresh")}a(this).siblings("#widget-list").toggle()});this.addEvents();a(".widget-error").parents(".widget").find("a.widget-action").click();a("#widget-list .widget").draggable({connectToSortable:".widgets-sortables",handle:".widget-title",distance:2,helper:"clone",zIndex:5,start:function(){wpWidgets.fixWebkit(1)},stop:function(d,c){if(b){a(b).hide()}b="";wpWidgets.fixWebkit()}});a(".widgets-sortables").sortable({placeholder:"widget-placeholder",connectWith:".widgets-sortables",items:".widget",handle:".widget-title",cursor:"move",distance:2,opacity:0.65,start:function(d,c){wpWidgets.fixWebkit(1);c.item.find(".widget-inside").hide();c.item.css({marginLeft:"",width:""})},stop:function(f,c){var d=c.item.find("input.add_new").val(),i=c.item.find("input.multi_number").val(),h=c.item.attr("id"),g=a(this).parent().attr("id");c.item.css({marginLeft:"",width:""});if(d){if("multi"==d){c.item.html(c.item.html().replace(/<[^<>]+>/g,function(e){return e.replace(/__i__/g,i)}));c.item.attr("id",h.replace(/__i__/g,i));i++;a("li#"+h).find("input.multi_number").val(i)}else{if("single"==d){c.item.attr("id","new-"+h);b="li#"+h}}wpWidgets.addEvents(c.item);wpWidgets.save(c.item.find("form").serializeArray(),g,0,0);c.item.find("input.add_new").val("");c.item.find("a.widget-action").click()}wpWidgets.saveOrder(g);wpWidgets.fixWebkit()},receive:function(d,c){if(!a(this).is(":visible")){a(this).sortable("cancel")}}}).not(":visible").sortable("disable")},saveOrder:function(c){a("#"+c+" .ajax-feedback").css("visibility","visible");var b={action:"widgets-order",savewidgets:a("#_wpnonce_widgets").val(),sidebars:[]};a(".widgets-sortables").each(function(){b["sidebars["+a(this).parent().attr("id")+"]"]=a(this).sortable("toArray").join(",")});a.post(ajaxurl,b,function(){a(".ajax-feedback").css("visibility","hidden")})},save:function(e,f,c,d){a("#"+f+" .ajax-feedback").css("visibility","visible");var b={action:"save-widget",savewidgets:a("#_wpnonce_widgets").val(),sidebar:f};if(c){b.delete_widget=1}a.map(e,function(h,g){b[h.name]=h.value});a.post(ajaxurl,b,function(g){var h;a(".ajax-feedback").css("visibility","hidden");if(!d){return}if(c){a(d).parents("li.widget").slideUp("normal",function(){a(this).remove()});if(!b.widget_number){h=b["widget-id"];a("#available-widgets .widget-id").each(function(){if(a(this).val()==h){a(this).parents("li.widget").show()}})}}else{a(d).parents(".widget-inside").slideUp("normal",function(){a(this).parents("li.widget").css({width:"",marginLeft:""})})}})},fixWebkit:function(b){b=b?"none":"";a("body").css({WebkitUserSelect:b,KhtmlUserSelect:b})},addEvents:function(b){b=b||document;a("a.widget-action",b).click(function(){var d=parseInt(a(this).parents(".widget").find(".widget-width").val(),10),e={},c=a(this).parents(".widget-top").siblings(".widget-inside");if(c.is(":hidden")){if(d>270&&c.parents(".widgets-sortables").length){e.width=d+30+"px";if(c.parents(".widget-liquid-right").length){e.marginLeft=270-d+"px"}c.parents(".widget").css(e)}c.slideDown("normal")}else{c.slideUp("normal",function(){c.parents(".widget").css({width:"",marginLeft:""})})}return false});a(".widget-control-save",b).click(function(){wpWidgets.save(a(this).parents("form").serializeArray(),a(this).parents(".widgets-holder-wrap").attr("id"),0,this);return false});a(".widget-control-remove",b).click(function(){wpWidgets.save(a(this).parents("form").serializeArray(),a(this).parents(".widgets-holder-wrap").attr("id"),1,this);return false})}};a(document).ready(function(){wpWidgets.init()})})(jQuery);
     1var wpWidgets;(function(a){wpWidgets={init:function(){var e,d=a("#available-widgets .widget-holder").height(),c=a("#widgets-right .widgets-holder-wrap .widgets-sortables:first"),b=c.height();a("#widgets-right h3.sidebar-name").click(function(){var f=a(this).siblings(".widgets-sortables");if(f.is(":visible")){f.hide().sortable("disable");a(this).parent().addClass("closed")}else{f.show().sortable("enable").sortable("refresh");a(this).parent().removeClass("closed")}});a("#widgets-left h3.sidebar-name").click(function(){if(a(this).siblings(".widget-holder").is(":visible")){a(this).parent().addClass("closed")}else{a(this).parent().removeClass("closed")}});if(d>b){c.css("minHeight",d+"px")}this.addEvents();a(".widget-error").parents(".widget").find("a.widget-action").click();a("#widget-list .widget").draggable({connectToSortable:".widgets-sortables",handle:".widget-title",distance:2,helper:"clone",zIndex:5,start:function(g,f){wpWidgets.fixWebkit(1);f.helper.find(".widget-description").hide()},stop:function(g,f){if(e){a(e).hide()}e="";wpWidgets.fixWebkit()}});a(".widgets-sortables").sortable({placeholder:"widget-placeholder",connectWith:".widgets-sortables",items:".widget",handle:".widget-title",cursor:"move",distance:2,opacity:0.65,start:function(g,f){wpWidgets.fixWebkit(1);f.item.find(".widget-inside").hide();f.item.css({marginLeft:"",width:""})},stop:function(h,f){var g=f.item.find("input.add_new").val(),k=f.item.find("input.multi_number").val(),j=f.item.attr("id"),i=a(this).attr("id");f.item.css({marginLeft:"",width:""});if(g){if("multi"==g){f.item.html(f.item.html().replace(/<[^<>]+>/g,function(l){return l.replace(/__i__/g,k)}));f.item.attr("id",j.replace(/__i__/g,k));k++;a("div#"+j).find("input.multi_number").val(k)}else{if("single"==g){f.item.attr("id","new-"+j);e="div#"+j}}wpWidgets.addEvents(f.item);wpWidgets.save(f.item.find("form").serializeArray(),i,0,0);f.item.find("input.add_new").val("");f.item.find("a.widget-action").click()}wpWidgets.saveOrder(i);wpWidgets.fixWebkit()},receive:function(g,f){if(!a(this).is(":visible")){a(this).sortable("cancel")}}}).not(":visible").sortable("disable")},saveOrder:function(c){a("#"+c).parents(".widgets-holder-wrap").find(".ajax-feedback").css("visibility","visible");var b={action:"widgets-order",savewidgets:a("#_wpnonce_widgets").val(),sidebars:[]};a(".widgets-sortables").each(function(){b["sidebars["+a(this).attr("id")+"]"]=a(this).sortable("toArray").join(",")});a.post(ajaxurl,b,function(){a(".ajax-feedback").css("visibility","hidden")})},save:function(e,f,c,d){a("#"+f).parents(".widgets-holder-wrap").find(".ajax-feedback").css("visibility","visible");var b={action:"save-widget",savewidgets:a("#_wpnonce_widgets").val(),sidebar:f};if(c){b.delete_widget=1}a.map(e,function(h,g){b[h.name]=h.value});a.post(ajaxurl,b,function(g){var h;a(".ajax-feedback").css("visibility","hidden");if(!d){return}if(c){a(d).parents(".widget").slideUp("normal",function(){a(this).remove()});if(!b.widget_number){h=b["widget-id"];a("#available-widgets .widget-id").each(function(){if(a(this).val()==h){a(this).parents(".widget").show()}})}}else{a(d).parents(".widget-inside").slideUp("normal",function(){a(this).parents(".widget").css({width:"",marginLeft:""})})}})},fixWebkit:function(b){b=b?"none":"";a("body").css({WebkitUserSelect:b,KhtmlUserSelect:b})},addEvents:function(b){b=b||document;a("a.widget-action",b).click(function(){var d=parseInt(a(this).parents(".widget").find(".widget-width").val(),10),e={},c=a(this).parents(".widget-top").siblings(".widget-inside");if(c.is(":hidden")){if(d>250&&c.parents(".widgets-sortables").length){e.width=d+30+"px";if(c.parents(".widget-liquid-right").length){e.marginLeft=234-d+"px"}c.parents(".widget").css(e)}c.slideDown("normal")}else{c.slideUp("normal",function(){c.parents(".widget").css({width:"",marginLeft:""})})}return false});a(".widget-control-save",b).click(function(){wpWidgets.save(a(this).parents("form").serializeArray(),a(this).parents(".widgets-sortables").attr("id"),0,this);return false});a(".widget-control-remove",b).click(function(){wpWidgets.save(a(this).parents("form").serializeArray(),a(this).parents(".widgets-sortables").attr("id"),1,this);return false})}};a(document).ready(function(){wpWidgets.init()})})(jQuery);
  • trunk/wp-admin/widgets.php

    r11150 r11160  
    256256
    257257        <form action="widgets.php" method="post">
    258         <div class="widget-control">
     258        <div class="widget-inside">
    259259<?php   call_user_func_array( $control_callback, $control['params'] ); ?>
    260260        </div>
    261261
     262        <p class="describe"><?php _e('Select both the sidebar for this widget and the position of the widget in that sidebar.'); ?></p>
    262263        <div class="widget-position">
    263264        <table class="widefat"><thead><tr><th><?php _e('Sidebar'); ?></th><th><?php _e('Position'); ?></th></tr></thead><tbody>
     
    300301        <input type="hidden" name="multi_number" class="multi_number" value="<?php echo attr($multi_number); ?>" />
    301302<?php   wp_nonce_field("save-delete-widget-$widget_id"); ?>
     303        <br class="clear" />
    302304        </div>
    303305        </form>
     
    342344    </div>
    343345
    344     <div id="wp_inactive_widgets" class="widgets-holder-wrap">
     346    <div class="widgets-holder-wrap">
    345347        <h3 class="sidebar-name"><?php _e('Inactive Widgets'); ?>
    346348        <span><img src="images/wpspin.gif" class="ajax-feedback" title="" alt="" /></span></h3>
    347         <p class="description"><?php _e('Drag widgets here to remove them from the web site but keep their settings.'); ?></p>
     349        <div class="widget-holder inactive">
     350        <p class="description"><?php _e('Drag widgets here to remove them from the sidebar but keep their settings.'); ?></p>
    348351        <?php wp_list_widget_controls('wp_inactive_widgets'); ?>
    349352        <br class="clear" />
     353        </div>
    350354    </div>
    351355</div>
     
    353357
    354358<div class="widget-liquid-right">
     359<div id="widgets-right">
    355360<?php
    356361$i = 0;
    357362foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
    358363    if ( 'wp_inactive_widgets' == $sidebar )
    359         continue; ?>
    360     <div id="<?php echo attr( $sidebar ); ?>" class="widgets-holder-wrap">
     364        continue;
     365    $closed = $i ? ' closed' : ''; ?>
     366    <div class="widgets-holder-wrap<?php echo $closed; ?>">
    361367    <h3 class="sidebar-name"><?php echo wp_specialchars( $registered_sidebar['name'] ); ?>
    362368    <span><img src="images/wpspin.gif" class="ajax-feedback" title="" alt="" /></span></h3>
    363     <?php wp_list_widget_controls( $sidebar, $i ); // Show the control forms for each of the widgets in this sidebar ?>
     369    <?php wp_list_widget_controls( $sidebar ); // Show the control forms for each of the widgets in this sidebar ?>
    364370    </div>
    365371<?php
    366372    $i++;
    367373} ?>
     374</div>
    368375</div>
    369376<form action="" method="post">
  • trunk/wp-includes/default-widgets.php

    r11109 r11160  
    577577        <p><label for="<?php echo $this->get_field_id('number'); ?>">
    578578        <?php _e('Number of posts to show:'); ?>
    579         <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" /></label>
     579        <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></label>
    580580        <br /><small><?php _e('(at most 15)'); ?></small></p>
    581581<?php
     
    664664        <p><label for="<?php echo $this->get_field_id('number'); ?>">
    665665        <?php _e('Number of comments to show:'); ?>
    666         <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" /></label>
     666        <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></label>
    667667        <br /><small><?php _e('(at most 15)'); ?></small></p>
    668668<?php
  • trunk/wp-includes/script-loader.php

    r11119 r11160  
    331331        $scripts->add_data( 'media-upload', 'group', 1 );
    332332
    333         $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable' ), '20090426' );
     333        $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable' ), '20090502' );
    334334        $scripts->add_data( 'admin-widgets', 'group', 1 );
    335335
     
    425425    $styles->add_data( 'ie', 'conditional', 'lte IE 7' );
    426426
    427     $styles->add( 'colors', true, array(), '20090419' ); // Register "meta" stylesheet for admin colors
     427    $styles->add( 'colors', true, array(), '20090502' ); // Register "meta" stylesheet for admin colors
    428428    $styles->add( 'colors-fresh', '/wp-admin/css/colors-fresh.css', array(), '20081210'); // for login.php.  Is there a better way?
    429429    $styles->add_data( 'colors-fresh', 'rtl', true );
     
    433433    $styles->add( 'global', '/wp-admin/css/global.css', array(), '20090415' );
    434434    $styles->add( 'media', '/wp-admin/css/media.css', array(), '20090325' );
    435     $styles->add( 'widgets', '/wp-admin/css/widgets.css', array(), '20090419' );
     435    $styles->add( 'widgets', '/wp-admin/css/widgets.css', array(), '20090502' );
    436436    $styles->add( 'dashboard', '/wp-admin/css/dashboard.css', array(), '20090305' );
    437437    $styles->add( 'install', '/wp-admin/css/install.css', array(), '20081210' );
  • trunk/wp-includes/widgets.php

    r11155 r11160  
    824824    $sidebars_widgets = wp_get_sidebars_widgets(false);
    825825
    826     if ( is_array($sidebars_widgets) ) foreach ( $sidebars_widgets as $sidebar => $widgets )
    827         if ( 'wp_inactive_widgets' == $sidebar )
    828             continue;
    829 
    830         if ( is_array($widgets) ) foreach ( $widgets as $widget )
    831             if ( ( $callback && isset($wp_registered_widgets[$widget]['callback']) && $wp_registered_widgets[$widget]['callback'] == $callback ) || ( $id_base && preg_replace( '/-[0-9]+$/', '', $widget ) == $id_base ) ) {
    832                 if ( !$widget_id || $widget_id == $wp_registered_widgets[$widget]['id'] )
    833                     return $sidebar;
     826    if ( is_array($sidebars_widgets) ) {
     827        foreach ( $sidebars_widgets as $sidebar => $widgets ) {
     828            if ( is_array($widgets) ) {
     829                foreach ( $widgets as $widget ) {
     830                    if ( ( $callback && isset($wp_registered_widgets[$widget]['callback']) && $wp_registered_widgets[$widget]['callback'] == $callback ) || ( $id_base && preg_replace( '/-[0-9]+$/', '', $widget ) == $id_base ) ) {
     831                        if ( !$widget_id || $widget_id == $wp_registered_widgets[$widget]['id'] )
     832                            return $sidebar;
     833                    }
     834                }
    834835            }
    835 
     836        }
     837    }
    836838    return false;
    837839}
Note: See TracChangeset for help on using the changeset viewer.