Make WordPress Core


Ignore:
Timestamp:
11/15/2010 11:48:24 PM (13 years ago)
Author:
nacin
Message:

Next pass on internal linking. Functional, but needs styling. props koopersmith, see #11420.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/tinymce/wp-mce-link.php

    r16159 r16393  
    2424wp_print_scripts( array('jquery', 'jquery-ui-widget') );
    2525?>
    26 <script type="text/javascript" src="plugins/wplink/js/wplink.js?ver=20101023"></script>
     26<?php
     27    $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
     28    $src = "plugins/wplink/js/wplink$suffix.js?ver=20101023";
     29?>
     30<script type="text/javascript" src="<?php echo $src; ?>"></script>
    2731<?php
    2832wp_admin_css( 'global', true );
     
    4448}
    4549
    46 #link-header,
    4750#link-options,
    4851#link-advanced-options {
     
    5053    border-bottom: 1px solid #dfdfdf;
    5154}
    52     #link-header {
    53         padding-bottom: 0;
    54         background: #fff;
    55     }
    56     #link-panel-tab-bar li {
    57         font-weight: bold;
    58         border: #dfdfdf solid;
    59         margin-right: 5px;
    60         border-width: 1px 1px 0;
    61     }
    62     #link-panel-tab-bar .wp-tab-active {
    63         border-color:#ccc;
    64         background-color: #f1f1f1;
    65     }
    6655
    6756#link-type {
     
    7867
    7968label input[type="text"] {
    80     width: 220px;
    81 }
    82     .wp-tab-panel label input[type="text"] {
    83         float: left;
    84         width: 200px;
    85     }
     69    width: 360px;
     70    margin-top: 5px;
     71}
    8672
    8773label span {
     
    9177    padding-right: 5px;
    9278}
    93     .wp-tab-panel label span {
    94         width: auto;
    95         text-align: left;
    96         float: left;
    97         margin-top: 3px;
    98     }
    9979    .link-search-wrapper {
    10080        padding: 5px;
    101         border-bottom: solid 1px #dfdfdf;
    10281        display: block;
    10382        overflow: hidden;
    10483    }
     84        .link-search-wrapper span {
     85            float: left;
     86            margin-top: 6px;
     87        }
     88        .link-search-wrapper input[type="text"] {
     89            float: left;
     90            width: 220px;
     91        }
    10592        .link-search-wrapper img.waiting {
    106             margin: 4px 1px 0 4px;
     93            margin: 8px 1px 0 4px;
    10794            float: left;
    10895            display: none;
     
    117104        font-size: 11px;
    118105    }
     106   
     107.query-results {
     108    border: #dfdfdf solid;
     109    border-width: 1px 0;
     110    margin: 5px 0;
     111    background: #fff;
     112    height: 220px;
     113    overflow: auto;
     114}
     115    .query-results li {
     116        margin-bottom: 0;
     117        border-bottom: 1px solid #dfdfdf;
     118        color: #555;
     119        padding: 4px 6px;
     120        cursor: pointer;
     121    }
     122    .query-results li:hover {
     123        background: #EAF2FA;
     124        color: #333;
     125    }
     126    .query-results li.selected {
     127        background: #f1f1f1;
     128        font-weight: bold;
     129        color: #333;
     130    }
     131.item-info {
     132    text-transform: uppercase;
     133    color: #aaa;
     134    font-weight: bold;
     135    font-size: 11px;
     136    float: right;
     137}
     138#search-results {
     139    display: none;
     140}
     141   
     142.wp-results-pagelinks {
     143    padding:4px 0;
     144    margin:0 auto;
     145    text-align:center;
     146}
     147    .wp-results-pagelinks-top {
     148        border-bottom: 1px solid #dfdfdf;
     149    }
    119150
    120151.submitbox {
    121     padding: 5px;
     152    padding: 5px 5px 0;
    122153    font-size: 11px;
    123154    overflow: auto;
     
    135166    display: inline-block;
    136167}
    137 .wp-tab-active,
    138 .wp-tab-panel {
    139     background: #fff;
    140 }
    141     .wp-tab-panel {
    142         height: 160px;
    143         padding: 0;
    144     }
    145 .wp-tab-panel li {
    146     margin-bottom: 0;
    147     border-bottom: 1px solid #dfdfdf;
    148     color: #555;
    149     padding: 4px 6px;
    150     cursor: pointer;
    151 }
    152     .wp-tab-panel li:hover {
    153         background: #EAF2FA;
    154         color: #333;
    155     }
    156     .wp-tab-panel li.selected {
    157         background: #f1f1f1;
    158         font-weight: bold;
    159         color: #333;
    160     }
    161 .wp-tab-panel-pagelinks {
    162     display: none;
    163     padding:4px 0;
    164     margin:0 auto;
    165     text-align:center;
    166 }
    167     .wp-tab-panel-pagelinks-top {
    168         border-bottom: 1px solid #dfdfdf;
    169     }
    170168</style>
    171169</head>
    172170<?php
    173 // @TODO: Support custom post types.
    174 // $pts = get_post_types( array( 'public' => true ), 'objects' );
    175 $pts = array( get_post_type_object( 'post' ), get_post_type_object( 'page' ) );
    176 $queries = array(
    177     array( 'preset' => 'all', 'label' => __('View All') ),
    178     array( 'preset' => 'recent', 'label' => __('Most Recent') ),
    179     array( 'preset' => 'search', 'label' => __('Search') )
    180 );
    181 
    182 $tb = new WP_Tab_Bar();
    183 $tb->id = 'link-panel-tab-bar';
    184 $tb->add( 'link-panel-id-custom', __('External Link') );
    185 foreach( $pts as $pt ) {
    186     $tb->add( "link-panel-id-pt-$pt->name", $pt->labels->singular_name );
    187 }
    188171
    189172
    190173?>
    191174<body id="post-body">
    192 <div id="link-header">
    193     <?php $tb->render(); ?>
    194 </div>
    195175<div id="link-selector">
    196     <?php
    197     wp_link_panel_custom();
    198     foreach( $pts as $pt )
    199         wp_link_panel_structure('pt', $pt->name, $queries);
    200     ?>
    201176    <div id="link-options">
     177        <label for="url-field">
     178            <span><?php _e('URL:'); ?></span><input id="url-field" type="text" />
     179        </label>
    202180        <label for="link-title-field">
    203181            <span><?php _e('Description:'); ?></span><input id="link-title-field" type="text" />
     
    206184            <input type="checkbox" id="link-target-checkbox" /><span><?php _e('Open in new tab'); ?></span>
    207185        </label>
     186    </div>
     187    <div id="search-panel">
     188        <label for="search-field" class="link-search-wrapper">
     189            <span><?php _e('Search:'); ?></span>
     190            <input type="text" id="search-field" class="link-search-field" />
     191            <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
     192        </label>
     193       
     194        <div id="search-results" class="query-results">
     195            <div class="wp-results-pagelinks wp-results-pagelinks-top"></div>
     196            <ul>
     197                <li class="wp-results-loading unselectable"><em><?php _e('Loading...'); ?></em></li>
     198            </ul>
     199            <div class="wp-results-pagelinks wp-results-pagelinks-bottom"></div>
     200        </div>
     201       
     202        <?php $most_recent = wp_link_query(); ?>
     203        <div id="most-recent-results" class="query-results">
     204            <div class="wp-results-pagelinks wp-results-pagelinks-top">
     205                <?php echo $most_recent['pages']['page_links']; ?>
     206            </div>
     207            <ul>
     208                <?php foreach ( $most_recent['results'] as $item ): ?>
     209                    <li>
     210                        <input type="hidden" class="item-permalink" value="<?php echo esc_url( $item['permalink'] ); ?>" />
     211                        <span class="item-title"><?php echo $item['title']; ?></span>
     212                        <span class="item-info"><?php echo esc_html( $item['info'] ); ?></span>
     213                    </li>
     214                <?php endforeach; ?>
     215            </ul>
     216            <div class="wp-results-pagelinks wp-results-pagelinks-bottom">
     217                <?php echo $most_recent['pages']['page_links']; ?>
     218            </div>
     219        </div>
    208220    </div>
    209221</div>
Note: See TracChangeset for help on using the changeset viewer.