Commit 68702954 authored by Patrick Schmalstig's avatar Patrick Schmalstig
Browse files

Implemented MANTIS-5624 (Make private topics visually distinct from public topics)

parent 7fdc19d3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -498,7 +498,7 @@ class Module_topicview
                    decache_private_topics(get_member());
                }

                $emphasis = cns_get_post_emphasis($_postdetails);
                list($post_class, $emphasis) = cns_get_post_emphasis($_postdetails, $topic_info);

                require_code('feedback');
                if (!array_key_exists('whisper_to_member', $_postdetails) && get_value('disable_post_rating', '0', true) !== '1') {
@@ -522,7 +522,7 @@ class Module_topicview
                    'TOPIC_FIRST_POSTER' => ($topic_info['first_poster'] === null) ? '' : strval($topic_info['first_poster']),
                    'POST_ID' => $is_spacer_post ? '' : ((get_option('seq_post_ids') == '1') ? strval($start + $array_id + 1) : strval($_postdetails['id'])),
                    'URL' => $post_url,
                    'CLASS' => $_postdetails['is_emphasised'] ? 'cns-post-emphasis' : (array_key_exists('whisper_to_member', $_postdetails) ? 'cns-post-personal' : ''),
                    'CLASS' => $post_class,
                    'EMPHASIS' => $emphasis,
                    'FIRST_UNREAD' => $first_unread,
                    'POSTER_TITLE' => $is_spacer_post ? '' : $_postdetails['poster_title'],
+2 −9
Original line number Diff line number Diff line
@@ -189,14 +189,7 @@ function render_post_box(array $row, bool $use_post_title = false, bool $give_co
    }

    // Emphasis? PP to?
    $emphasis = new Tempcode();
    if ($row['p_is_emphasised'] == 1) {
        $emphasis = do_lang_tempcode('IMPORTANT');
    } elseif ($row['p_whisper_to_member'] !== null) {
        $pp_to_displayname = $GLOBALS['FORUM_DRIVER']->get_username($row['p_whisper_to_member'], true);
        $pp_to_username = $GLOBALS['FORUM_DRIVER']->get_username($row['p_whisper_to_member']);
        $emphasis = do_lang('PP_TO', $pp_to_displayname, $pp_to_username);
    }
    list($post_class, $emphasis) = cns_get_post_emphasis($row, null);

    // Feedback
    require_code('feedback');
@@ -212,7 +205,7 @@ function render_post_box(array $row, bool $use_post_title = false, bool $give_co
        'TOPIC_FIRST_POSTER' => '',
        'POST_ID' => strval($row['id']),
        'URL' => $post_url,
        'CLASS' => ($row['p_is_emphasised'] == 1) ? 'cns-post-emphasis' : (($row['p_whisper_to_member'] !== null) ? 'cns-post-personal' : ''),
        'CLASS' => $post_class,
        'EMPHASIS' => $emphasis,
        'FIRST_UNREAD' => '',
        'POSTER_TITLE' => $poster_title,
+10 −3
Original line number Diff line number Diff line
@@ -869,17 +869,24 @@ function cns_render_post_buttons(array $topic_info, array $_postdetails, bool $m
 * Get post emphasis Tempcode.
 *
 * @param  array $_postdetails Map of post info
 * @return Tempcode The Tempcode
 * @param  ?array $topic_info Map of topic info (null: not available or not running Conversr)
 * @return array A pair of emphasis class to use and the text Tempcode
 */
function cns_get_post_emphasis(array $_postdetails) : object
function cns_get_post_emphasis(array $_postdetails, ?array $topic_info) : array
{
    $emphasis = new Tempcode();
    $post_class = '';
    if ($_postdetails['is_emphasised']) {
        $emphasis = do_lang_tempcode('IMPORTANT');
        $post_class = 'cns-post-emphasis';
    } elseif (array_key_exists('whisper_to_member', $_postdetails)) {
        $pp_to_displayname = $GLOBALS['FORUM_DRIVER']->get_username($_postdetails['whisper_to_member'], true);
        $pp_to_username = $GLOBALS['FORUM_DRIVER']->get_username($_postdetails['whisper_to_member']);
        $emphasis = do_lang_tempcode('PP_TO', escape_html($pp_to_displayname), escape_html($pp_to_username));
        $post_class = 'cns-post-personal';
    } elseif (($topic_info !== null) && ($topic_info['forum_id'] === null)) {
        $emphasis = do_lang_tempcode('PRIVATE_TOPIC');
        $post_class = 'cns-post-private-topic';
    }
    return $emphasis;
    return [$post_class, $emphasis];
}
+1 −1
Original line number Diff line number Diff line
@@ -836,7 +836,7 @@ class CMS_Topic
                }

                // Misc meta details for post
                $emphasis = cns_get_post_emphasis($post);
                list($post_class, $emphasis) = cns_get_post_emphasis($post, $topic_info);
                $not_validated = ($post['validated'] == 0) ? do_lang_tempcode('NOT_VALIDATED') : new Tempcode();
                if (array_key_exists('last_edit_time', $post)) {
                    $last_edited = do_template('CNS_TOPIC_POST_LAST_EDITED', [
+2 −0
Original line number Diff line number Diff line
@@ -9,3 +9,5 @@
{$THEMEWIZARD_COLOR,#180c0d,emphasis_text,10% emphasis_background + 90% BW}
{$THEMEWIZARD_COLOR,#ef777f,cns_polls_background,50% FF0000 + 50% area_2_background}
{$THEMEWIZARD_COLOR,#180c0d,cns_polls_text,10% cns_polls_background + 90% BW}
{$THEMEWIZARD_COLOR,#efd883,cns_private_topic_post_background,50% FFC107 + 50% area_2_background}
{$THEMEWIZARD_COLOR,#000000,cns_private_topic_post_text,100% BW}
 No newline at end of file
Loading