Changeset 9518

Show
Ignore:
Timestamp:
11/04/08 23:15:59 (2 months ago)
Author:
azaozz
Message:

Add "Choose from popular tags" to the tags postbox

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/admin-ajax.php

    r9354 r9518  
    422422    ) ); 
    423423    $x->send(); 
     424    break; 
     425case 'get-tagcloud' : 
     426    if ( !current_user_can( 'manage_categories' ) ) 
     427        die('-1'); 
     428 
     429    $tags = get_tags( array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) ); 
     430     
     431    if ( empty( $tags ) ) 
     432        die('0'); 
     433     
     434    foreach ( $tags as $key => $tag ) { 
     435        $tags[ $key ]->link = '#'; 
     436        $tags[ $key ]->id = $tag->term_id; 
     437    } 
     438 
     439    $return = wp_generate_tag_cloud( $tags ); 
     440 
     441    if ( empty($return) ) 
     442        die('0'); 
     443     
     444    echo $return; 
     445     
     446    exit; 
    424447    break; 
    425448case 'add-comment' : 
  • trunk/wp-admin/css/colors-fresh.css

    r9436 r9518  
    890890 
    891891#timestampdiv input, 
    892 #namediv input { 
     892#namediv input, 
     893#tagsdiv #the-tagcloud { 
    893894    border-color: #ddd; 
    894895} 
  • trunk/wp-admin/css/global.css

    r9428 r9518  
    146146/* styles for use by people extending the WordPress interface */ 
    147147 
    148 body    { 
    149     margin: 0; 
    150     padding: 0; 
    151 
    152  
    153 body, td { 
    154     font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif; 
    155 
    156  
    157 form, label input { 
    158     margin: 0; 
    159     padding: 0; 
    160 
    161  
    162 img { 
    163     border: 0; 
     148body, 
     149td { 
     150    font: 13px/19px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif; 
     151
     152 
     153p { 
     154    margin: 1em 0; 
     155
     156 
     157blockquote { 
     158    margin: 1em; 
    164159} 
    165160 
     
    168163} 
    169164 
    170 li, dd { 
     165li, 
     166dd { 
    171167    margin-bottom: 6px; 
    172168} 
    173169 
    174 p, li, dl, dd, dt { 
     170p, 
     171li, 
     172dl, 
     173dd, 
     174dt { 
    175175    line-height: 140%; 
    176176} 
    177177 
    178 textarea, input, select { 
    179     font: 13px Verdana, Arial, Helvetica, sans-serif; 
     178textarea, 
     179input, 
     180select { 
     181    font: 13px/19px Verdana, Arial, Helvetica, sans-serif; 
    180182    margin: 1px; 
    181183    padding: 3px; 
     
    292294} 
    293295 
    294 .widefat td, .widefat th { 
     296.widefat td, 
     297.widefat th { 
    295298    border-bottom-width: 1px; 
    296299    border-bottom-style: solid; 
     
    327330    padding: 10px 0 22px; 
    328331} 
    329 /* 
    330 th.check-column + th, th.check-column + td { 
    331     padding-left: 5px; 
    332 
    333 */ 
     332 
    334333.widefat .num, 
    335334.widefat .column-comments { 
     
    341340} 
    342341 
    343 .wrap, .updated, .error { 
     342.wrap, 
     343.updated, 
     344.error { 
    344345    margin: 0 15px; 
    345346    padding: 0; 
    346347} 
    347348 
    348 .updated, .error { 
     349.updated, 
     350.error { 
    349351    border-width: 1px; 
    350352    border-style: solid; 
     
    353355} 
    354356 
    355 .updated p, .error p { 
     357.updated p, 
     358.error p { 
    356359    margin: 0.6em 0; 
    357360} 
    358361 
    359 .wrap .updated, .wrap .error { 
     362.wrap .updated, 
     363.wrap .error { 
    360364    margin: auto 0 0; 
    361365} 
    362366 
    363 .updated a, .error a { 
     367.updated a, 
     368.error a { 
    364369    text-decoration: underline; 
    365370} 
  • trunk/wp-admin/edit-form-advanced.php

    r9506 r9518  
    236236<p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p> 
    237237<div id="tagchecklist"></div> 
    238 <p><a href='#'><?php _e( 'Choose from tags' ); ?></a></p> 
     238<p id="tagcloud-link" class="hide-if-no-js"><a href='#'><?php _e( 'Choose from the most popular tags' ); ?></a></p> 
    239239<?php 
    240240} 
  • trunk/wp-admin/edit-tags.php

    r9363 r9518  
    243243    wp_tag_cloud(array('link' => 'edit'));  
    244244else 
    245     wp_tag_cloud();  
     245    wp_tag_cloud(); 
    246246?> 
    247247</div> 
  • trunk/wp-admin/js/post.js

    r9491 r9518  
    3838} 
    3939 
    40 function tag_flush_to_text() { 
    41     var newtags = jQuery('#tags-input').val() + ',' + jQuery('#newtag').val(); 
     40function tag_flush_to_text(e,a) { 
     41    a = a || false; 
     42    var text = a ? jQuery(a).text() : jQuery('#newtag').val(); 
     43    var newtags = jQuery('#tags-input').val(); 
     44    var t = text.replace( /\s*([^,]+)[\s,]*/, '$1' ); 
     45 
     46    if ( newtags.indexOf(t) != -1 ) 
     47        return false; 
     48 
     49    newtags += ',' + text; 
     50 
    4251    // massage 
    4352    newtags = newtags.replace( /\s+,+\s*/g, ',' ).replace( /,+/g, ',' ).replace( /,+\s+,+/g, ',' ).replace( /,+\s*$/g, '' ).replace( /^\s*,+/g, '' ); 
    4453    jQuery('#tags-input').val( newtags ); 
    4554    tag_update_quickclicks(); 
    46     jQuery('#newtag').val(''); 
    47     jQuery('#newtag').focus(); 
     55    if ( ! a ) { 
     56        jQuery('#newtag').val(''); 
     57        jQuery('#newtag').focus(); 
     58    } 
    4859    return false; 
    4960} 
     
    5970        return false; 
    6071    } 
    61 
     72}; 
     73 
     74(function($){ 
     75    tagCloud = { 
     76        init : function() { 
     77            $('#tagcloud-link').click(function(){tagCloud.get(); return false;}); 
     78        }, 
     79 
     80        get : function() { 
     81            $.post('admin-ajax.php', {'action':'get-tagcloud'}, function(r, stat) { 
     82                if ( 0 == r || 'success' != stat ) 
     83                    r = wpAjax.broken; 
     84 
     85                r = '<p id="the-tagcloud">'+r+'</p>'; 
     86                $('#tagcloud-link').after($(r)); 
     87                $('#the-tagcloud a').click(function(){ 
     88                    tag_flush_to_text(0,this); 
     89                    return false; 
     90                }); 
     91            }); 
     92        } 
     93    } 
     94})(jQuery); 
    6295 
    6396jQuery(document).ready( function($) { 
     97    tagCloud.init(); 
     98     
    6499    // close postboxes that should be closed 
    65100    jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed'); 
  • trunk/wp-admin/wp-admin.css

    r9510 r9518  
    29222922    margin-top: 8px; 
    29232923} 
     2924 
     2925#tagsdiv #the-tagcloud { 
     2926    margin: 5px 5px 10px; 
     2927    padding: 8px; 
     2928    border-width: 1px; 
     2929    border-style: solid; 
     2930    line-height: 1.8em; 
     2931    word-spacing: 3px; 
     2932    -moz-border-radius: 6px; 
     2933    -khtml-border-radius: 6px; 
     2934    -webkit-border-radius: 6px; 
     2935    border-radius: 6px; 
     2936} 
  • trunk/wp-includes/category-template.php

    r9475 r9518  
    665665    foreach ( $tags as $key => $tag ) { 
    666666        $count = $counts[ $key ]; 
    667         $tag_link = clean_url( $tag->link )
     667        $tag_link = '#' != $tag->link ? clean_url( $tag->link ) : '#'
    668668        $tag_id = isset($tags[ $key ]->id) ? $tags[ $key ]->id : $key; 
    669669        $tag_name = $tags[ $key ]->name;