<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[16159] trunk/wp-includes/js/tinymce: Tabs for internal linking.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16159">16159</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-11-02 23:25:24 +0000 (Tue, 02 Nov 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Tabs for internal linking. props koopersmith, see <a href="http://trac.wordpress.org/ticket/11420">#11420</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesjstinymcepluginswplinkjswplinkjs">trunk/wp-includes/js/tinymce/plugins/wplink/js/wplink.js</a></li>
<li><a href="#trunkwpincludesjstinymcewpmcelinkincludesphp">trunk/wp-includes/js/tinymce/wp-mce-link-includes.php</a></li>
<li><a href="#trunkwpincludesjstinymcewpmcelinkphp">trunk/wp-includes/js/tinymce/wp-mce-link.php</a></li>
<li><a href="#trunkwpincludesjstinymcewptinymcejsgz">trunk/wp-includes/js/tinymce/wp-tinymce.js.gz</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesjstinymcepluginswplinkjswplinkjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/plugins/wplink/js/wplink.js (16158 => 16159)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wplink/js/wplink.js        2010-11-02 22:13:16 UTC (rev 16158)
+++ trunk/wp-includes/js/tinymce/plugins/wplink/js/wplink.js        2010-11-02 23:25:24 UTC (rev 16159)
</span><span class="lines">@@ -66,23 +66,20 @@
</span><span class="cx">                         inputs.title = $('#link-title-field');
</span><span class="cx">                         // Advanced Options
</span><span class="cx">                         inputs.openInNewTab = $('#link-target-checkbox');
</span><del>-                        // Types
-                        inputs.typeDropdown = $('#link-type');
-                        inputs.typeOptions = inputs.typeDropdown.find('option');
</del><span class="cx">                         
</span><span class="cx">                         panels = $('.link-panel');
</span><span class="cx">                         active = $('.link-panel-active');
</span><ins>+                        $('#link-panel-tab-bar').wpTabs({
+                                show: function(e, widget) {
+                                        active = widget.panel;
+                                        active.addClass('link-panel-active');
+                                        wpLink.maybeLoadPanel();
+                                },
+                                hide: function(e, widget) {
+                                        active.removeClass('link-panel-active');
+                                }
+                        })
</ins><span class="cx">                         
</span><del>-                        // Extract type names
-                        inputs.typeOptions.each( function(){
-                                var linkType = this.id.replace(/^link-option-id-/,''),
-                                        parts = linkType.split('-');
-                                $(this).data( 'link-type', {
-                                        full : linkType,
-                                        type : parts[0],
-                                        name : parts[1] || ''
-                                });
-                        });
</del><span class="cx">                         panels.each( function(){
</span><span class="cx">                                 var linkType = this.id.replace(/^link-panel-id-/,''),
</span><span class="cx">                                         parts = linkType.split('-');
</span><span class="lines">@@ -94,7 +91,6 @@
</span><span class="cx">                         });
</span><span class="cx">                         
</span><span class="cx">                         // Bind event handlers
</span><del>-                        inputs.typeDropdown.change( wpLink.selectPanel );
</del><span class="cx">                         $('#wp-update').click( wpLink.update );
</span><span class="cx">                         $('#wp-cancel').click( function() { tinyMCEPopup.close(); } );
</span><span class="cx">                         $('.link-panel .wp-tab-bar').wpTabs('option', 'show', wpLink.maybeLoadPanel );
</span><span class="lines">@@ -107,7 +103,6 @@
</span><span class="cx">                         if ( ! e )
</span><span class="cx">                                 return;
</span><span class="cx">                         
</span><del>-                        // @TODO: select proper panel/fill values when a link is edited
</del><span class="cx">                         active.find('input.url-field').val( e.href );
</span><span class="cx">                         inputs.title.val( ed.dom.getAttrib(e, 'title') );
</span><span class="cx">                         // Advanced Options
</span><span class="lines">@@ -193,19 +188,6 @@
</span><span class="cx">                         tinyMCEPopup.close();
</span><span class="cx">                 },
</span><span class="cx">                 
</span><del>-                selectPanel : function( option ) {
-                        var sel = inputs.typeOptions.filter(':selected');
-                        
-                        if ( option.jquery ) {
-                                sel.removeAttr('selected');
-                                sel = option.attr('selected', 'selected');
-                        }
-                        
-                        active.removeClass('link-panel-active');
-                        active = $('#link-panel-id-' + sel.data('link-type').full ).addClass('link-panel-active');
-                        wpLink.maybeLoadPanel();
-                },
-                
</del><span class="cx">                 maybeLoadPanel : function() {
</span><span class="cx">                         var panel = active.find('.wp-tab-panel:visible');
</span><span class="cx">                         if ( panel.length && panel.find('.wp-tab-panel-loading').length )
</span></span></pre></div>
<a id="trunkwpincludesjstinymcewpmcelinkincludesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/wp-mce-link-includes.php (16158 => 16159)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/wp-mce-link-includes.php        2010-11-02 22:13:16 UTC (rev 16158)
+++ trunk/wp-includes/js/tinymce/wp-mce-link-includes.php        2010-11-02 23:25:24 UTC (rev 16159)
</span><span class="lines">@@ -3,6 +3,9 @@
</span><span class="cx"> class WP_Tab_Bar {
</span><span class="cx">         var $tabs = array();
</span><span class="cx">         
</span><ins>+        var $id = '';
+        var $classes = array();
+        
</ins><span class="cx">         var $selected = '';
</span><span class="cx">         
</span><span class="cx">         function add( $id, $label, $url='' ) {
</span><span class="lines">@@ -21,7 +24,9 @@
</span><span class="cx">                 if ( empty( $this->selected ) )
</span><span class="cx">                         $this->selected = $this->tabs[0]['for'];
</span><span class="cx">
</span><del>-                $out = "<ul class='wp-tab-bar'>";
</del><ins>+                array_unshift( $this->classes, 'wp-tab-bar' );
+                
+                $out = "<ul id='$this->id' class='" . esc_attr( implode( ' ', $this->classes ) ) . "'>";
</ins><span class="cx">                 foreach( $this->tabs as $tab ) {
</span><span class="cx">                         if ( !isset($tab['url']) )
</span><span class="cx">                                 $tab['url'] = '';
</span></span></pre></div>
<a id="trunkwpincludesjstinymcewpmcelinkphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/wp-mce-link.php (16158 => 16159)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/wp-mce-link.php        2010-11-02 22:13:16 UTC (rev 16158)
+++ trunk/wp-includes/js/tinymce/wp-mce-link.php        2010-11-02 23:25:24 UTC (rev 16159)
</span><span class="lines">@@ -49,6 +49,21 @@
</span><span class="cx">         padding: 5px;
</span><span class="cx">         border-bottom: 1px solid #dfdfdf;
</span><span class="cx"> }
</span><ins>+        #link-header {
+                padding-bottom: 0;
+                background: #fff;
+        }
+        #link-panel-tab-bar li {
+                font-weight: bold;
+                border: #dfdfdf solid;
+                margin-right: 5px;
+                border-width: 1px 1px 0;
+        }
+        #link-panel-tab-bar .wp-tab-active {
+                border-color:#ccc;
+                background-color: #f1f1f1;
+        }
+
</ins><span class="cx"> #link-type {
</span><span class="cx">         width: 140px;
</span><span class="cx"> }
</span><span class="lines">@@ -155,28 +170,27 @@
</span><span class="cx"> </style>
</span><span class="cx"> </head>
</span><span class="cx"> <?php
</span><del>-
-$pts = get_post_types( array( 'public' => true ), 'objects' );
</del><ins>+// @TODO: Support custom post types.
+// $pts = get_post_types( array( 'public' => true ), 'objects' );
+$pts = array( get_post_type_object( 'post' ), get_post_type_object( 'page' ) );
</ins><span class="cx"> $queries = array(
</span><span class="cx">         array( 'preset' => 'all', 'label' => __('View All') ),
</span><span class="cx">         array( 'preset' => 'recent', 'label' => __('Most Recent') ),
</span><span class="cx">         array( 'preset' => 'search', 'label' => __('Search') )
</span><span class="cx"> );
</span><span class="cx">
</span><ins>+$tb = new WP_Tab_Bar();
+$tb->id = 'link-panel-tab-bar';
+$tb->add( 'link-panel-id-custom', __('External Link') );
+foreach( $pts as $pt ) {
+        $tb->add( "link-panel-id-pt-$pt->name", $pt->labels->singular_name );
+}
+
+
</ins><span class="cx"> ?>
</span><span class="cx"> <body id="post-body">
</span><span class="cx"> <div id="link-header">
</span><del>-        <label for="link-type">
-                <span><strong><?php _e('Link Type:'); ?></strong>
-                </span><select id="link-type">
-                        <option id="link-option-id-custom" class="link-custom"><?php _e('External Link'); ?></option>
-                <?php
-                foreach ( $pts as $pt ) {
-                        echo "<option id='link-option-id-pt-$pt->name' class='link-option-pt'>";
-                        echo $pt->labels->singular_name . '</option>';
-                } ?>
-                </select>
-        </label>
</del><ins>+        <?php $tb->render(); ?>
</ins><span class="cx"> </div>
</span><span class="cx"> <div id="link-selector">
</span><span class="cx">         <?php
</span></span></pre></div>
<a id="trunkwpincludesjstinymcewptinymcejsgz"></a>
<div class="binary"><h4>Modified: trunk/wp-includes/js/tinymce/wp-tinymce.js.gz</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
</div>
</body>
</html>