Skip to:
Content

Ignore:
Timestamp:
01/18/2012 02:49:20 AM (7 years ago)
Author:
johnjamesjacoby
Message:

Refactor forum/topic/reply contextual help, shamelessly sampled from the WordPress 'post' content type. See #1699.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-admin/bbp-replies.php

    r3627 r3686  
    4242        $this->setup_globals();
    4343        $this->setup_actions();
    44         $this->setup_help();
    4544    }
    4645
     
    8786        add_filter( 'restrict_manage_posts', array( $this, 'filter_dropdown'  ) );
    8887        add_filter( 'request',               array( $this, 'filter_post_rows' ) );
     88
     89        // Contextual Help
     90        add_action( 'load-edit.php',     array( $this, 'edit_help' ) );
     91        add_action( 'load-post-new.php', array( $this, 'new_help'  ) );
    8992    }
    9093
     
    101104    }
    102105
    103     /**
    104      * Contextual help for replies
     106    /** Contextual Help *******************************************************/
     107
     108    /**
     109     * Contextual help for bbPress reply edit page
    105110     *
    106111     * @since bbPress (r3119)
    107      * @access private
    108      */
    109     function setup_help() {
    110 
    111         // Define local variable(s)
    112         $contextual_help     = '';
    113         $bbp_contextual_help = array();
    114 
    115         /** New/Edit **********************************************************/
    116 
    117         $bbp_contextual_help[] = __( 'The reply title field and the big reply editing area are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of the box. Use the Screen Options tab to unhide more boxes (Reply Attributes, Slug) or to choose a 1- or 2-column layout for this screen.', 'bbpress' );
    118         $bbp_contextual_help[] = __( '<strong>Title</strong> - Enter a title for your reply. After you enter a title, you will see the permalink below, which you can edit.', 'bbpress' );
    119         $bbp_contextual_help[] = __( '<strong>Post editor</strong> - Enter the text for your reply. There are two modes of editing: Visual and HTML. Choose the mode by clicking on the appropriate tab. Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. The screen icon just before that allows you to expand the edit box to full screen. The HTML mode allows you to enter raw HTML along with your forum text. You can insert media files by clicking the icons above the post editor and following the directions.', 'bbpress' );
    120         $bbp_contextual_help[] = __( '<strong>Reply Attributes</strong> - Select the attributes that your reply should have. The Parent Topic dropdown determines the parent topic that the reply belongs to.', 'bbpress' );
    121         $bbp_contextual_help[] = __( '<strong>Publish</strong> - The Publish box will allow you to save your reply as Draft or Pending Review. You may Preview your reply before it is published as well. The Visibility will determine whether the reply is Public, Password protected (requiring a password on the site to view) or Private (only the author will have access to it). Replies may be published immediately by clicking the dropdown, or at a specific date and time by clicking the Edit link.', 'bbpress' );
    122         $bbp_contextual_help[] = __( '<strong>Revisions</strong> - Revisions show past versions of the saved reply. Each revision can be compared to the current version, or another revision. Revisions can also be restored to the current version.', 'bbpress' );
    123         $bbp_contextual_help[] = __( '<strong>For more information:</strong>', 'bbpress' );
    124         $bbp_contextual_help[] =
    125             '<ul>' .
    126                 '<li>' . __( '<a href="http://bbpress.org/documentation/">bbPress Documentation</a>', 'bbpress' ) . '</li>' .
    127                 '<li>' . __( '<a href="http://bbpress.org/forums/">bbPress Support Forums</a>', 'bbpress' ) . '</li>' .
    128             '</ul>' ;
    129 
    130         // Wrap each help item in paragraph tags
    131         foreach( $bbp_contextual_help as $paragraph )
    132             $contextual_help .= '<p>' . $paragraph . '</p>';
    133 
    134         // Add help
    135         add_contextual_help( bbp_get_reply_post_type(), $contextual_help );
    136 
    137         // Reset
    138         $contextual_help     = '';
    139         $bbp_contextual_help = array();
    140 
    141         /** Post Rows *********************************************************/
    142 
    143         $bbp_contextual_help[] = __( 'This screen displays the replies created on your site.', 'bbpress' );
    144         $bbp_contextual_help[] = __( 'You can customize the display of this screen in a number of ways:', 'bbpress' );
    145         $bbp_contextual_help[] =
    146             '<ul>' .
    147                 '<li>' . __( 'You can hide/display columns based on your needs (Forum, Topic, Author, and Created) and decide how many replies to list per screen using the Screen Options tab.', 'bbpress' ) . '</li>' .
    148                 '<li>' . __( 'You can filter the list of replies by reply status using the text links in the upper left to show All, Published, Pending Review, Draft, or Trashed topics. The default view is to show all replies.', 'bbpress' ) . '</li>' .
    149                 '<li>' . __( 'You can view replies in a simple title list or with an excerpt. Choose the view you prefer by clicking on the icons at the top of the list on the right.', 'bbpress' ) . '</li>' .
    150                 '<li>' . __( 'You can refine the list to show only replies from a specific month by using the dropdown menus above the replies list. Click the Filter button after making your selection.', 'bbpress' ) . '</li>' .
    151                 '<li>' . __( 'You can also show only replies from a specific parent forum by using the parent forum dropdown above the replies list and selecting the parent forum. Click the Filter button after making your selection.', 'bbpress' ) . '</li>' .
    152             '</ul>';
    153 
    154         $bbp_contextual_help[] = __( 'Hovering over a row in the replies list will display action links that allow you to manage your reply. You can perform the following actions:', 'bbpress' );
    155         $bbp_contextual_help[] =
    156             '<ul>' .
    157                 '<li>' . __( 'Edit takes you to the editing screen for that reply. You can also reach that screen by clicking on the reply title.', 'bbpress' ) . '</li>' .
    158                 '<li>' . __( 'Trash removes your reply from this list and places it in the trash, from which you can permanently delete it.', 'bbpress' ) . '</li>' .
    159                 '<li>' . __( 'View will take you to your live reply to view the reply.', 'bbpress' ) . '</li>' .
    160                 '<li>' . __( 'Spam will mark the topic as spam, preventing further replies to it and removing it from the site&rsquo;s public view.', 'bbpress' ) . '</li>' .
    161             '</ul>';
    162 
    163         $bbp_contextual_help[] = __( 'You can also edit multiple replies at once. Select the replies you want to edit using the checkboxes, select Edit from the Bulk Actions menu and click Apply. You will be able to change the metadata for all selected replies at once. To remove a reply from the grouping, just click the x next to its name in the Bulk Edit area that appears.', 'bbpress' );
    164         $bbp_contextual_help[] = __( 'The Bulk Actions menu may also be used to delete multiple replies at once. Select Delete from the dropdown after making your selection.', 'bbpress' );
    165         $bbp_contextual_help[] = __( '<strong>For more information:</strong>', 'bbpress' );
    166         $bbp_contextual_help[] =
    167             '<ul>' .
    168                 '<li>' . __( '<a href="http://bbpress.org/documentation/">bbPress Documentation</a>', 'bbpress' ) . '</li>' .
    169                 '<li>' . __( '<a href="http://bbpress.org/forums/">bbPress Support Forums</a>', 'bbpress', 'bbpress' ) . '</li>' .
    170             '</ul>';
    171 
    172         // Wrap each help item in paragraph tags
    173         foreach( $bbp_contextual_help as $paragraph )
    174             $contextual_help .= '<p>' . $paragraph . '</p>';
    175 
    176         // Add help
    177         add_contextual_help( 'edit-' . bbp_get_reply_post_type(), $contextual_help );
     112     * @uses get_current_screen()
     113     */
     114    public function edit_help() {
     115
     116        $current_screen = get_current_screen();
     117        $post_type      = !empty( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : '';
     118
     119        // Bail if current screen could not be found
     120        if ( empty( $current_screen ) )
     121            return;
     122
     123        // Bail if not the reply post type
     124        if ( $post_type != $this->post_type )
     125            return;
     126
     127        // Overview
     128        $current_screen->add_help_tab( array(
     129            'id'        => 'overview',
     130            'title'     => __( 'Overview', 'bbpress' ),
     131            'content'   =>
     132                '<p>' . __( 'This screen provides access to all of your replies. You can customize the display of this screen to suit your workflow.', 'bbpress' ) . '</p>'
     133        ) );
     134
     135        // Screen Content
     136        $current_screen->add_help_tab( array(
     137            'id'        => 'screen-content',
     138            'title'     => __( 'Screen Content', 'bbpress' ),
     139            'content'   =>
     140                '<p>' . __( 'You can customize the display of this screen&#8217;s contents in a number of ways:' ) . '</p>' .
     141                '<ul>' .
     142                    '<li>' . __( 'You can hide/display columns based on your needs and decide how many replies to list per screen using the Screen Options tab.',                                                                                                                                                                          'bbpress' ) . '</li>' .
     143                    '<li>' . __( 'You can filter the list of replies by reply status using the text links in the upper left to show All, Published, Draft, or Trashed replies. The default view is to show all replies.',                                                                                                                   'bbpress' ) . '</li>' .
     144                    '<li>' . __( 'You can view replies in a simple title list or with an excerpt. Choose the view you prefer by clicking on the icons at the top of the list on the right.',                                                                                                                                             'bbpress' ) . '</li>' .
     145                    '<li>' . __( 'You can refine the list to show only replies in a specific category or from a specific month by using the dropdown menus above the replies list. Click the Filter button after making your selection. You also can refine the list by clicking on the reply author, category or tag in the replies list.', 'bbpress' ) . '</li>' .
     146                '</ul>'
     147        ) );
     148
     149        // Available Actions
     150        $current_screen->add_help_tab( array(
     151            'id'        => 'action-links',
     152            'title'     => __( 'Available Actions', 'bbpress' ),
     153            'content'   =>
     154                '<p>' . __( 'Hovering over a row in the replies list will display action links that allow you to manage your reply. You can perform the following actions:', 'bbpress' ) . '</p>' .
     155                '<ul>' .
     156                    '<li>' . __( '<strong>Edit</strong> takes you to the editing screen for that reply. You can also reach that screen by clicking on the reply title.',                                                                                 'bbpress' ) . '</li>' .
     157                    //'<li>' . __( '<strong>Quick Edit</strong> provides inline access to the metadata of your reply, allowing you to update reply details without leaving this screen.',                                                                  'bbpress' ) . '</li>' .
     158                    '<li>' . __( '<strong>Trash</strong> removes your reply from this list and places it in the trash, from which you can permanently delete it.',                                                                                       'bbpress' ) . '</li>' .
     159                    '<li>' . __( '<strong>Spam</strong> removes your reply from this list and places it in the spam queue, from which you can permanently delete it.',                                                                                   'bbpress' ) . '</li>' .
     160                    '<li>' . __( '<strong>Preview</strong> will show you what your draft reply will look like if you publish it. View will take you to your live site to view the reply. Which link is available depends on your reply&#8217;s status.', 'bbpress' ) . '</li>' .
     161                '</ul>'
     162        ) );
     163
     164        // Bulk Actions
     165        $current_screen->add_help_tab( array(
     166            'id'        => 'bulk-actions',
     167            'title'     => __( 'Bulk Actions', 'bbpress' ),
     168            'content'   =>
     169                '<p>' . __( 'You can also edit or move multiple replies to the trash at once. Select the replies you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply.',           'bbpress' ) . '</p>' .
     170                '<p>' . __( 'When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected replies at once. To remove a reply from the grouping, just click the x next to its name in the Bulk Edit area that appears.', 'bbpress' ) . '</p>'
     171        ) );
     172
     173        // Help Sidebar
     174        $current_screen->set_help_sidebar(
     175            '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
     176            '<p>' . __( '<a href="http://bbpress.org/documentation/" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' .
     177            '<p>' . __( '<a href="http://bbpress.org/forums/" target="_blank">bbPress Support Forums</a>',       'bbpress' ) . '</p>'
     178        );
     179    }
     180
     181    /**
     182     * Contextual help for bbPress reply edit page
     183     *
     184     * @since bbPress (r3119)
     185     * @uses get_current_screen()
     186     */
     187    public function new_help() {
     188
     189        $current_screen = get_current_screen();
     190        $post_type      = !empty( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : '';
     191
     192        // Bail if current screen could not be found
     193        if ( empty( $current_screen ) )
     194            return;
     195
     196        // Bail if not the reply post type
     197        if ( $post_type != $this->post_type )
     198            return;
     199
     200        $customize_display = '<p>' . __( 'The title field and the big reply editing Area are fixed in place, but you can reposition all the other boxes using drag and drop, and can minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.', 'bbpress' ) . '</p>';
     201
     202        $current_screen->add_help_tab( array(
     203            'id'      => 'customize-display',
     204            'title'   => __( 'Customizing This Display', 'bbpress' ),
     205            'content' => $customize_display,
     206        ) );
     207
     208        $current_screen->add_help_tab( array(
     209            'id'      => 'title-reply-editor',
     210            'title'   => __( 'Title and Reply Editor', 'bbpress' ),
     211            'content' =>
     212                '<p>' . __( '<strong>Title</strong> - Enter a title for your reply. After you enter a title, you&#8217;ll see the permalink below, which you can edit.', 'bbpress' ) . '</p>' .
     213                '<p>' . __( '<strong>Reply Editor</strong> - Enter the text for your reply. There are two modes of editing: Visual and HTML. Choose the mode by clicking on the appropriate tab. Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. The HTML mode allows you to enter raw HTML along with your reply text. You can insert media files by clicking the icons above the reply editor and following the directions. You can go to the distraction-free writing screen via the Fullscreen icon in Visual mode (second to last in the top row) or the Fullscreen button in HTML mode (last in the row). Once there, you can make buttons visible by hovering over the top area. Exit Fullscreen back to the regular reply editor.', 'bbpress' ) . '</p>'
     214        ) );
     215
     216        $publish_box = '<p>' . __( '<strong>Publish</strong> - You can set the terms of publishing your reply in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a reply or making it stay at the top of your blog indefinitely (sticky). Publish (immediately) allows you to set a future or past date and time, so you can schedule a reply to be published in the future or backdate a reply.', 'bbpress' ) . '</p>';
     217
     218        if ( current_theme_supports( 'reply-formats' ) && reply_type_supports( 'reply', 'reply-formats' ) ) {
     219            $publish_box .= '<p>' . __( '<strong>reply Format</strong> - This designates how your theme will display a specific reply. For example, you could have a <em>standard</em> blog reply with a title and paragraphs, or a short <em>aside</em> that omits the title and contains a short text blurb. Please refer to the Codex for <a href="http://codex.wordpress.org/reply_Formats#Supported_Formats">descriptions of each reply format</a>. Your theme could enable all or some of 10 possible formats.', 'bbpress' ) . '</p>';
     220        }
     221
     222        if ( current_theme_supports( 'reply-thumbnails' ) && reply_type_supports( 'reply', 'thumbnail' ) ) {
     223            $publish_box .= '<p>' . __( '<strong>Featured Image</strong> - This allows you to associate an image with your reply without inserting it. This is usually useful only if your theme makes use of the featured image as a reply thumbnail on the home page, a custom header, etc.', 'bbpress' ) . '</p>';
     224        }
     225
     226        $current_screen->add_help_tab( array(
     227            'id'      => 'publish-box',
     228            'title'   => __( 'Publish Box', 'bbpress' ),
     229            'content' => $publish_box,
     230        ) );
     231
     232        $current_screen->add_help_tab( array(
     233            'id'      => 'discussion-settings',
     234            'title'   => __( 'Discussion Settings', 'bbpress' ),
     235            'content' =>
     236                '<p>' . __( '<strong>Send Trackbacks</strong> - Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they&#8217;ll be notified automatically using pingbacks, and this field is unnecessary.', 'bbpress' ) . '</p>' .
     237                '<p>' . __( '<strong>Discussion</strong> - You can turn comments and pings on or off, and if there are comments on the reply, you can see them here and moderate them.', 'bbpress' ) . '</p>'
     238        ) );
     239
     240        $current_screen->set_help_sidebar(
     241            '<p><strong>' . __( 'For more information:', 'bbpress' ) . '</strong></p>' .
     242            '<p>' . __( '<a href="http://bbpress.org/documentation/" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' .
     243            '<p>' . __( '<a href="http://bbpress.org/forums/" target="_blank">bbPress Support Forums</a>',       'bbpress' ) . '</p>'
     244        );
    178245    }
    179246
     
    263330     */
    264331    function author_metabox() {
    265         global $current_screen;
    266332
    267333        // Bail if post_type is not a reply
Note: See TracChangeset for help on using the changeset viewer.