diff --git a/wp-admin/edit-link-form.php b/wp-admin/edit-link-form.php index 46c4d4b3f..86a7e06a2 100644 --- a/wp-admin/edit-link-form.php +++ b/wp-admin/edit-link-form.php @@ -30,26 +30,80 @@ function xfn_check($class, $value = '', $deprecated = '') { } ?> -
-

+
+
-
-
-
-

-
-

- +
+

+
+ +
-
-
-

-
+
+

+
+ +
+
+ +
+

+
+ +
+
+ +
+

+ +

+
+ +
+

+
+ +
+

+

+ + 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category') ) ); ?> + + + +

+
+ +
    +
  • +
  • +
+ +
+
    + +
+
+ + + +
+
+ +

+ +
+

+
@@ -60,47 +114,23 @@ function xfn_check($class, $value = '', $deprecated = '') { link_target == '') ? 'checked="checked"' : ''); ?> />
-
+
-
-

-
+
+

+
-
-
-
- - - - - - - - - - - - - -
- -

- -

- -
- -
-

-
+
+

+
@@ -209,11 +239,11 @@ function xfn_check($class, $value = '', $deprecated = '') {
-
+
-
-

-
+
+

+
@@ -242,7 +272,6 @@ function xfn_check($class, $value = '', $deprecated = '') {
-
@@ -253,6 +282,11 @@ function xfn_check($class, $value = '', $deprecated = '') { +
+ + + + + - diff --git a/wp-admin/js/link.js b/wp-admin/js/link.js new file mode 100644 index 000000000..cc7bf8498 --- /dev/null +++ b/wp-admin/js/link.js @@ -0,0 +1,54 @@ +addLoadEvent( function() { + // postboxes + add_postbox_toggles(); + + // category tabs + var categoryTabs = jQuery('#category-tabs').tabs(); + + // Ajax Cat + var newCat = jQuery('#newcat').one( 'focus', function() { jQuery(this).val( '' ).removeClass( 'form-input-tip' ) } ); + jQuery('#category-add-sumbit').click( function() { newCat.focus(); } ); + var newCatParent = false; + var newCatParentOption = false; + var noSyncChecks = false; // prophylactic. necessary? + var syncChecks = function() { + if ( noSyncChecks ) + return; + noSyncChecks = true; + var th = jQuery(this); + var c = th.is(':checked'); + var id = th.val().toString(); + jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c ); + noSyncChecks = false; + }; + var catAddAfter = function( r, s ) { + if ( !newCatParent ) newCatParent = jQuery('#newcat_parent'); + if ( !newCatParentOption ) newCatParentOption = newCatParent.find( 'option[value=-1]' ); + jQuery(s.what + ' response_data', r).each( function() { + var t = jQuery(jQuery(this).text()); + t.find( 'label' ).each( function() { + var th = jQuery(this); + var val = th.find('input').val(); + var id = th.find('input')[0].id + jQuery('#' + id).change( syncChecks ); + if ( newCatParent.find( 'option[value=' + val + ']' ).size() ) + return; + var name = jQuery.trim( th.text() ); + var o = jQuery( '' ).text( name ); + newCatParent.prepend( o ); + } ); + newCatParentOption.attr( 'selected', true ); + } ); + }; + jQuery('#categorychecklist').wpList( { + alt: '', + response: 'category-ajax-response', + addAfter: catAddAfter + } ); + jQuery('#category-add-toggle').click( function() { + jQuery(this).parents('div:first').toggleClass( 'wp-hidden-children' ); + categoryTabs.tabsClick( 1 ); + return false; + } ); + jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change(); +}); \ No newline at end of file diff --git a/wp-admin/link-add.php b/wp-admin/link-add.php index b751a14b9..a1148a478 100644 --- a/wp-admin/link-add.php +++ b/wp-admin/link-add.php @@ -11,8 +11,9 @@ wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]')); -if ( current_user_can( 'manage_categories' ) ) - wp_enqueue_script( 'ajaxcat' ); +wp_enqueue_script('link'); +wp_enqueue_script('thickbox'); + require('admin-header.php'); ?> diff --git a/wp-admin/link.php b/wp-admin/link.php index 043b3f9e4..62ad4abd6 100644 --- a/wp-admin/link.php +++ b/wp-admin/link.php @@ -83,8 +83,9 @@ switch ($action) { break; case 'edit' : - if ( current_user_can( 'manage_categories' ) ) - wp_enqueue_script( 'ajaxlinkcat' ); + wp_enqueue_script('link'); + wp_enqueue_script('thickbox'); + $parent_file = 'link-manager.php'; $submenu_file = 'link-manager.php'; $title = __('Edit Link'); diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 8c974e8c0..36874fa05 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -142,6 +142,7 @@ class WP_Scripts { 'cancel' => __('Cancel'), 'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php', ) ); + $this->add( 'link', '/wp-admin/js/link.js', array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20080131' ); $this->add( 'media-upload', '/wp-admin/js/media-upload.js', false, '20080109' ); $this->localize( 'upload', 'uploadL10n', array( 'browseTitle' => attribute_escape(__('Browse your files')),