ผู้เขียน หัวข้อ: Marking a topic solved or unsolved.  (อ่าน 2697 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ smf

  • [color=green][i]"ถ้าคุณไม่สามารถอธิบายอย่างง่ายๆ ให้คนอื่นเข้าใจได้แล้วล่ะก็ แสดงว่าคุณยังเข้าใจมันไม่ดีพอ"[/i][/color]
  • Administrator
  • Hero Member
  • *****
  • กระทู้: 1,368
  • พอยท์: 5
    • ดูรายละเอียด
    • pordoo.com
    • อีเมล์
Marking a topic solved or unsolved.
« เมื่อ: 24 ตุลาคม 2015, 10:44:50 »
Mod Name:Topic Solved
http://custom.simplemachines.org/mods/index.php?mod=1601


ติดตั้งเสร็จให้ไปที่ Modify Boards เลือกบอร์ดที่ต้องการใช้ คลิ้กmodify









ออฟไลน์ smf

  • [color=green][i]"ถ้าคุณไม่สามารถอธิบายอย่างง่ายๆ ให้คนอื่นเข้าใจได้แล้วล่ะก็ แสดงว่าคุณยังเข้าใจมันไม่ดีพอ"[/i][/color]
  • Administrator
  • Hero Member
  • *****
  • กระทู้: 1,368
  • พอยท์: 5
    • ดูรายละเอียด
    • pordoo.com
    • อีเมล์
Re: Marking a topic solved or unsolved.
« ตอบกลับ #1 เมื่อ: 26 กุมภาพันธ์ 2017, 23:02:35 »

If I selected 'Topic Solved', I hope this topic cannot reply (not including Administrator,Global Moderator,Moderator), how do I edit file?

install.xml

search
   
โค๊ด: [Select]
<file name="$sourcedir/Display.php">
<operation>
<search position="replace"><![CDATA[ $context['topic_first_message'] = $topicinfo['id_first_msg'];]]></search>
<add><![CDATA[ $context['topic_first_message'] = $topicinfo['id_first_msg'];
$context['topic_solved'] = $topicinfo['is_solved'];
$context['can_solve_topic'] =  (allowedTo('solve_topic_any') || (allowedTo('solve_topic_own') && $user_info['id'] == $topicinfo['id_member_started'])) && $board_info['topic_solved'];]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[t.num_replies, t.num_views, t.locked, ms.subject, t.is_sticky]]></search>
<add><![CDATA[t.num_replies, t.num_views, t.locked, ms.subject, t.is_sticky, t.is_solved]]></add>
</operation>
</file>

replace
   
โค๊ด: [Select]
<file name="$sourcedir/Display.php">
<operation>
<search position="replace"><![CDATA[ $context['topic_first_message'] = $topicinfo['id_first_msg'];]]></search>
<add><![CDATA[ $context['topic_first_message'] = $topicinfo['id_first_msg'];
$context['topic_solved'] = $topicinfo['is_solved'];
$context['can_solve_topic'] =  (allowedTo('solve_topic_any') || (allowedTo('solve_topic_own') && $user_info['id'] == $topicinfo['id_member_started'])) && $board_info['topic_solved'];]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[t.num_replies, t.num_views, t.locked, ms.subject, t.is_sticky]]></search>
<add><![CDATA[t.num_replies, t.num_views, t.locked, ms.subject, t.is_sticky, t.is_solved]]></add>
</operation>
<operation>
<search position="before"><![CDATA[$context['is_locked'] = $topicinfo['locked'];]]></search>
<add><![CDATA[$context['is_solved'] = $topicinfo['is_solved'];]]></add>
</operation>
<operation>
<search position="before"><![CDATA[$context['can_reply'] &= empty($topicinfo['locked']) || allowedTo('moderate_board');]]></search>
<add><![CDATA[$context['can_reply'] &= $context['is_solved'] == '0' || allowedTo('moderate_board');]]></add>
</operation>
</file>

ออฟไลน์ smf

  • [color=green][i]"ถ้าคุณไม่สามารถอธิบายอย่างง่ายๆ ให้คนอื่นเข้าใจได้แล้วล่ะก็ แสดงว่าคุณยังเข้าใจมันไม่ดีพอ"[/i][/color]
  • Administrator
  • Hero Member
  • *****
  • กระทู้: 1,368
  • พอยท์: 5
    • ดูรายละเอียด
    • pordoo.com
    • อีเมล์
how can I change the color of "TOPIC SOLVED"
« ตอบกลับ #2 เมื่อ: 26 กุมภาพันธ์ 2017, 23:22:55 »

./Themes/default/languages/Modifications.english.php

find:
โค๊ด: [Select]
$txt['topic_solved'] = 'Topic Solved';
replace:
โค๊ด: [Select]
$txt['topic_solved'] = '<span style="color: green;">Topic Solved</span>';
Some custom themes would require
โค๊ด: [Select]
$txt['topic_solved'] = '<font style="color: green;">Topic Solved</font>';
$txt['topic_not_solved'] = '<font style="color: red;">Topic Not Solved</font>';

or
โค๊ด: [Select]
$txt['topic_solved'] = '<div style="color: #00BB00; font-weight: bold;">Mark Topic Solved</div>';
$txt['topic_not_solved'] = '<div style="color: #FF0000; font-weight: bold;">Topic Not Solved</div>';
« แก้ไขครั้งสุดท้าย: 27 กุมภาพันธ์ 2017, 01:16:06 โดย smf »

ออฟไลน์ smf

  • [color=green][i]"ถ้าคุณไม่สามารถอธิบายอย่างง่ายๆ ให้คนอื่นเข้าใจได้แล้วล่ะก็ แสดงว่าคุณยังเข้าใจมันไม่ดีพอ"[/i][/color]
  • Administrator
  • Hero Member
  • *****
  • กระทู้: 1,368
  • พอยท์: 5
    • ดูรายละเอียด
    • pordoo.com
    • อีเมล์
Re: Marking a topic solved or unsolved.
« ตอบกลับ #3 เมื่อ: 27 กุมภาพันธ์ 2017, 19:18:58 »




in display.template

Search for:
โค๊ด: [Select]
function template_main()
{
   global $context, $settings, $options, $txt, $scripturl, $modSettings;

replace with:
โค๊ด: [Select]
function template_main()
{
   global $context, $settings, $options, $txt, $scripturl, $modSettings, $topicinfo, $board_info;

search for:
โค๊ด: [Select]
// Show the member's signature?
      if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
         echo '
                     <div class="signature" id="msg_', $message['id'], '_signature">', $message['member']['signature'], '</div>';

      echo '

and replace with:
โค๊ด: [Select]
// Show the member's signature?
      if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
         echo '
                     <div class="signature" id="msg_', $message['id'], '_signature">', $message['member']['signature'], '</div>';
        if ($message['id'] == $context['topic_last_message'] && ($board_info['topic_solved']))
        {
            echo'<div style="float:left;font-size:x-small;padding:0 4px;border: 1px solid #ddd;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;">';
            if ($topicinfo['is_solved'])
                echo'<a style="color:#ff0000;" href="'. $scripturl. '?action=topicsolved;topic=' . $context['current_topic'] . ';sesc=' . $context['session_id'] . '"><strong>Topic Not Solved</strong></a>';
            else
                echo'<a style="color:#00bb00;" href="'. $scripturl. '?action=topicsolved;topic=' . $context['current_topic'] . ';sesc=' . $context['session_id'] . '"><strong>Mark Topic Solved</strong></a>';
            echo'</div>';
        }
      echo '
« แก้ไขครั้งสุดท้าย: 27 กุมภาพันธ์ 2017, 19:31:12 โดย smf »

ออฟไลน์ smf

  • [color=green][i]"ถ้าคุณไม่สามารถอธิบายอย่างง่ายๆ ให้คนอื่นเข้าใจได้แล้วล่ะก็ แสดงว่าคุณยังเข้าใจมันไม่ดีพอ"[/i][/color]
  • Administrator
  • Hero Member
  • *****
  • กระทู้: 1,368
  • พอยท์: 5
    • ดูรายละเอียด
    • pordoo.com
    • อีเมล์
Re: Marking a topic solved or unsolved.
« ตอบกลับ #4 เมื่อ: 27 กุมภาพันธ์ 2017, 19:46:48 »



../Sources/MessageIndex.php

Find:
โค๊ด: [Select]
t.id_previous_board,
Replace:
โค๊ด: [Select]
t.id_previous_board, t.is_solved,
Find:
โค๊ด: [Select]
// Decide how many pages the topic should have.
Replace:
โค๊ด: [Select]
$row['first_subject'] = $row['is_solved'] ? '[SOLVED] ' . $row['first_subject'] : $row['first_subject'];

// Decide how many pages the topic should have.