- wp_enqueue_script('post');
- if ( user_can_richedit() )
- wp_enqueue_script('editor');
- add_thickbox();
- wp_enqueue_script('media-upload');
- wp_enqueue_script('word-count');
- wp_enqueue_script( 'admin-comments' );
- enqueue_comment_hotkeys_js();
-
- if ( $last = wp_check_post_lock( $post->ID ) ) {
- add_action('admin_notices', '_admin_notice_post_locked' );
+ $post_type = $post->post_type;
+ if ( 'post' == $post_type ) {
+ $parent_file = "edit.php";
+ $submenu_file = "edit.php";
+ $post_new_file = "post-new.php";
+ } elseif ( 'attachment' == $post_type ) {
+ $parent_file = 'upload.php';
+ $submenu_file = 'upload.php';
+ $post_new_file = 'media-new.php';
+ } else {
+ if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true )
+ $parent_file = $post_type_object->show_in_menu;
+ else
+ $parent_file = "edit.php?post_type=$post_type";
+ $submenu_file = "edit.php?post_type=$post_type";
+ $post_new_file = "post-new.php?post_type=$post_type";
+ }
+
+ if ( ! wp_check_post_lock( $post->ID ) ) {
+ $active_post_lock = wp_set_post_lock( $post->ID );
+
+ if ( 'attachment' !== $post_type )
+ wp_enqueue_script('autosave');
+ }
+
+ if ( is_multisite() ) {
+ add_action( 'admin_footer', '_admin_notice_post_locked' );