nas commited on 2010-11-30 09:50:56
Showing 7 changed files, with 432 additions and 0 deletions.
... | ... |
@@ -0,0 +1,87 @@ |
1 |
+<?php |
|
2 |
+/********************************************************************************** |
|
3 |
+* SolveTopic.php * |
|
4 |
+*********************************************************************************** |
|
5 |
+* Topic Solved mod for SMF 2.0, by SimpleDesk - www.simpledesk.net * |
|
6 |
+**********************************************************************************/ |
|
7 |
+ |
|
8 |
+if (!defined('SMF')) |
|
9 |
+ die('Hacking attempt...'); |
|
10 |
+ |
|
11 |
+/* This file has but one purpose - Solving and unsolving topics. |
|
12 |
+ |
|
13 |
+ void SolveTopic() |
|
14 |
+ - solves a topic, toggles between solved/not solved. |
|
15 |
+ - requires the solve_own or solve_any permission. |
|
16 |
+ - logs the action to the moderator log. |
|
17 |
+ - returns to the topic after it is done. |
|
18 |
+ - accessed via ?action=solve. |
|
19 |
+ |
|
20 |
+*/ |
|
21 |
+ |
|
22 |
+// Mark a topic solved. |
|
23 |
+function SolveTopic() |
|
24 |
+{ |
|
25 |
+ global $topic, $user_info, $sourcedir, $board, $smcFunc, $modSettings; |
|
26 |
+ |
|
27 |
+ // See if its enabled in this board. |
|
28 |
+ if (empty($modSettings['topicsolved_board_' . $board])) |
|
29 |
+ fatal_lang_error('topicsolved_not_enabled', false); |
|
30 |
+ |
|
31 |
+ // You need a topic to solve. |
|
32 |
+ if (empty($topic)) |
|
33 |
+ fatal_lang_error('not_a_topic', false); |
|
34 |
+ |
|
35 |
+ checkSession('get'); |
|
36 |
+ |
|
37 |
+ // Get the topic owner. |
|
38 |
+ $request = $smcFunc['db_query']('', ' |
|
39 |
+ SELECT id_member_started, solved, id_first_msg |
|
40 |
+ FROM {db_prefix}topics |
|
41 |
+ WHERE id_topic = {int:current_topic} |
|
42 |
+ LIMIT 1', |
|
43 |
+ array( |
|
44 |
+ 'current_topic' => $topic, |
|
45 |
+ ) |
|
46 |
+ ); |
|
47 |
+ list ($starter, $solved, $firstmsg) = $smcFunc['db_fetch_row']($request); |
|
48 |
+ $smcFunc['db_free_result']($request); |
|
49 |
+ |
|
50 |
+ // Youcansolvez? |
|
51 |
+ $user_solve = !allowedTo('solve_topic_any', $board); |
|
52 |
+ if ($user_solve && $starter == $user_info['id']) |
|
53 |
+ isAllowedTo('solve_own', $board); |
|
54 |
+ else |
|
55 |
+ isAllowedTo('solve_any', $board); |
|
56 |
+ |
|
57 |
+ // Mark the topic solved in the database. Simple enough. |
|
58 |
+ $smcFunc['db_query']('', ' |
|
59 |
+ UPDATE {db_prefix}topics |
|
60 |
+ SET solved = {int:solved_status} |
|
61 |
+ WHERE id_topic = {int:current_topic}', |
|
62 |
+ array( |
|
63 |
+ 'current_topic' => $topic, |
|
64 |
+ 'solved_status' => empty($solved) ? 1 : 0, |
|
65 |
+ ) |
|
66 |
+ ); |
|
67 |
+ |
|
68 |
+ // Also change the message icon. |
|
69 |
+ $smcFunc['db_query']('', ' |
|
70 |
+ UPDATE {db_prefix}messages |
|
71 |
+ SET icon = {string:icon} |
|
72 |
+ WHERE id_msg = {int:message}', |
|
73 |
+ array( |
|
74 |
+ 'message' => $firstmsg, |
|
75 |
+ 'icon' => empty($solved) ? 'solved' : 'xx', |
|
76 |
+ ) |
|
77 |
+ ); |
|
78 |
+ |
|
79 |
+ // Log this solve. if enabled. |
|
80 |
+ if(!empty($modSettings['enable_solved_log'])) |
|
81 |
+ logAction(empty($solved) ? 'solve' : 'unsolve', array('topic' => $topic, 'board' => $board, 'member' => $starter),'solve'); |
|
82 |
+ |
|
83 |
+ // Let's go back home. |
|
84 |
+ redirectexit('topic=' . $topic . '.' . $_REQUEST['start'] . (WIRELESS ? ';moderate' : '')); |
|
85 |
+} |
|
86 |
+ |
|
87 |
+?> |
|
0 | 88 |
\ No newline at end of file |
... | ... |
@@ -0,0 +1,61 @@ |
1 |
+<?xml version="1.0"?> |
|
2 |
+<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification"> |
|
3 |
+<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/"> |
|
4 |
+ <id>SimpleDesk:Topic_Solved_Mod</id> |
|
5 |
+ <version>1.0</version> |
|
6 |
+ |
|
7 |
+ <!-- English language --> |
|
8 |
+ <file name="$languagedir/Modifications.english.php"> |
|
9 |
+ <operation> |
|
10 |
+ <search position="end" /> |
|
11 |
+ <add><![CDATA[// Topic solved mod |
|
12 |
+$txt['topic_solved_title'] = 'Topic Solved mod'; |
|
13 |
+$txt['solve_topic'] = '<strong style="color: green">Mark topic solved</strong>'; |
|
14 |
+$txt['unsolve_topic'] = '<strong style="color: red">Mark topic not solved</strong>'; |
|
15 |
+$txt['modlog_ac_solve'] = 'Solved "{topic}" by {member}'; |
|
16 |
+$txt['modlog_ac_unsolve'] = 'Unsolved "{topic}" by {member}'; |
|
17 |
+$txt['modlog_solve_log'] = 'Topic solved log'; |
|
18 |
+$txt['modlog_solve_log_desc'] = 'Below is a list of all topics that have been solved or unsolved by your users.<br /><strong>Please note:</strong> Entries cannot be removed from this log until they are at least twenty-four hours old.'; |
|
19 |
+$txt['modlog_solve_log_no_entries_found'] = 'There are currently no entries in the topic solved log.'; |
|
20 |
+$txt['solve_log_help'] = '<strong>Topic solved log</strong><br />This section allows members of the moderation team to track all usage of the topic solved/not solved feature. To ensure that moderators cannot remove references to the actions they have performed, entries may not be deleted until 24 hours after the action was taken.'; |
|
21 |
+$txt['permissionname_solve_topic'] = 'Mark topics solved/not solved'; |
|
22 |
+$txt['permissionname_solve_topic_any'] = 'Any topic'; |
|
23 |
+$txt['permissionname_solve_topic_own'] = 'Own topic'; |
|
24 |
+$txt['permissionhelp_solve_topic'] = 'This permission will allow the user to mark topics as solved and not solved.'; |
|
25 |
+$txt['enable_solved_log'] = 'Enable logging of topic solving (Requires moderation logging to be enabled)'; |
|
26 |
+$txt['topicsolved_board_desc'] = '<span class="smalltext">Please select the boards you wish to enable the topic solved feature in.</span>'; |
|
27 |
+$txt['topicsolved_highlight'] = 'Highlight solved topics on the message index'; |
|
28 |
+$txt['topicsolved_highlight_col1'] = 'Color for highlighted solved topics (lighter columns, such as replies/view)'; |
|
29 |
+$txt['topicsolved_highlight_col2'] = 'Color for highlighted solved topics (darker columns, such as subject/started by)'; |
|
30 |
+$txt['topicsolved_display_notice'] = 'Display a notice inside of solved topics'; |
|
31 |
+$txt['topicsolved_is_solved'] = '<strong style="color: green;">Topic solved</strong><br />This topic is marked as solved and as such require no attention unless you want to bump this issue.'; |
|
32 |
+$txt['topicsolved_not_enabled'] = 'Topic solved is not enabled on this board.';]]></add> |
|
33 |
+ </operation> |
|
34 |
+ </file> |
|
35 |
+ <file name="$languagedir/Modifications.english-utf8.php" error="skip"> |
|
36 |
+ <operation> |
|
37 |
+ <search position="end" /> |
|
38 |
+ <add><![CDATA[// Topic solved mod |
|
39 |
+$txt['topic_solved_title'] = 'Topic Solved mod'; |
|
40 |
+$txt['solve_topic'] = '<strong style="color: green">Mark topic solved</strong>'; |
|
41 |
+$txt['unsolve_topic'] = '<strong style="color: red">Mark topic not solved</strong>'; |
|
42 |
+$txt['modlog_ac_solve'] = 'Solved "{topic}" by {member}'; |
|
43 |
+$txt['modlog_ac_unsolve'] = 'Unsolved "{topic}" by {member}'; |
|
44 |
+$txt['modlog_solve_log'] = 'Topic solved log'; |
|
45 |
+$txt['modlog_solve_log_desc'] = 'Below is a list of all topics that have been solved or unsolved by your users.<br /><strong>Please note:</strong> Entries cannot be removed from this log until they are at least twenty-four hours old.'; |
|
46 |
+$txt['modlog_solve_log_no_entries_found'] = 'There are currently no entries in the topic solved log.'; |
|
47 |
+$txt['solve_log_help'] = '<strong>Topic solved log</strong><br />This section allows members of the moderation team to track all usage of the topic solved/not solved feature. To ensure that moderators cannot remove references to the actions they have performed, entries may not be deleted until 24 hours after the action was taken.'; |
|
48 |
+$txt['permissionname_solve_topic'] = 'Mark topics solved/not solved'; |
|
49 |
+$txt['permissionname_solve_topic_any'] = 'Any topic'; |
|
50 |
+$txt['permissionname_solve_topic_own'] = 'Own topic'; |
|
51 |
+$txt['permissionhelp_solve_topic'] = 'This permission will allow the user to mark topics as solved and not solved.'; |
|
52 |
+$txt['enable_solved_log'] = 'Enable logging of topic solving'; |
|
53 |
+$txt['topicsolved_board_desc'] = '<span class="smalltext">Please select the boards you wish to enable the topic solved feature in.</span>'; |
|
54 |
+$txt['topicsolved_highlight'] = 'Highlight solved topics in green on the message index'; |
|
55 |
+$txt['topicsolved_display_notice'] = 'Display a notice inside of solved topics'; |
|
56 |
+$txt['topicsolved_is_solved'] = '<strong style="color: green;">Topic solved</strong><br />This topic is marked as solved and as such require no attention unless you want to bump this issue.'; |
|
57 |
+$txt['topicsolved_not_enabled'] = 'Topic solved is not enabled on this board.';]]></add> |
|
58 |
+ </operation> |
|
59 |
+ </file> |
|
60 |
+ |
|
61 |
+</modification> |
|
0 | 62 |
\ No newline at end of file |
... | ... |
@@ -0,0 +1,36 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF')) |
|
4 |
+ require_once(dirname(__FILE__) . '/SSI.php'); |
|
5 |
+elseif(!defined('SMF')) // If we are outside SMF and can't find SSI.php, then throw an error |
|
6 |
+ die('<b>Error:</b> Cannot install - please verify you put this file in the same place as SMF\'s SSI.php.'); |
|
7 |
+ |
|
8 |
+global $smcFunc; |
|
9 |
+ |
|
10 |
+if (!array_key_exists('db_add_column', $smcFunc)) |
|
11 |
+ db_extend('packages'); |
|
12 |
+ |
|
13 |
+if (empty($modSettings['topicsolved_highlight_col1'])) |
|
14 |
+{ |
|
15 |
+ $new_settings = array( |
|
16 |
+ 'topicsolved_highlight_col1' => '#eefee5', |
|
17 |
+ 'topicsolved_highlight_col2' => '#eafedd', |
|
18 |
+ ); |
|
19 |
+ |
|
20 |
+ foreach ($new_settings as $key => $value) |
|
21 |
+ updateSettings(array($key => $value)); |
|
22 |
+} |
|
23 |
+ |
|
24 |
+$check = $smcFunc['db_list_columns']('{db_prefix}topics'); |
|
25 |
+ |
|
26 |
+if (!in_array('solved', $check)) |
|
27 |
+ $smcFunc['db_add_column']('{db_prefix}topics', array('name' => 'solved', 'type' => 'tinyint', 'size' => 4)); |
|
28 |
+ |
|
29 |
+$installed = $smcFunc['db_list_columns']('{db_prefix}topics'); |
|
30 |
+ |
|
31 |
+if (in_array('solved', $installed)) |
|
32 |
+ echo'Database edits completed!'; |
|
33 |
+else |
|
34 |
+ echo'Database edits failed!'; |
|
35 |
+ |
|
36 |
+?> |
|
0 | 37 |
\ No newline at end of file |
... | ... |
@@ -0,0 +1,224 @@ |
1 |
+<?xml version="1.0"?> |
|
2 |
+<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification"> |
|
3 |
+<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/"> |
|
4 |
+ <id>SimpleDesk:Topic_Solved_Mod</id> |
|
5 |
+ <version>1.0</version> |
|
6 |
+ |
|
7 |
+ <!-- Template files --> |
|
8 |
+ <file name="$themedir/MessageIndex.template.php"> |
|
9 |
+ <operation> |
|
10 |
+ <search position="replace"><![CDATA[$color_class = 'windowbg';]]></search> |
|
11 |
+ <add><![CDATA[$color_class = 'windowbg'; |
|
12 |
+ |
|
13 |
+ // Solved topics |
|
14 |
+ if ($topic['is_solved'] && $topic['is_locked']) |
|
15 |
+ $color_class = 'lockedbg solvedbg'; |
|
16 |
+ elseif ($topic['is_solved']) |
|
17 |
+ $color_class = 'solvedbg';]]></add> |
|
18 |
+ </operation> |
|
19 |
+ </file> |
|
20 |
+ <file name="$themedir/Display.template.php"> |
|
21 |
+ <operation> |
|
22 |
+ <search position="before"><![CDATA[// Show the anchor for the top and for the first message. If the first message is new, say so.]]></search> |
|
23 |
+ <add><![CDATA[// Let them know that this is solved |
|
24 |
+ if(!empty($modSettings['topicsolved_display_notice']) && $context['is_solved'] && $context['board_solve']) |
|
25 |
+ echo'<br /><div class="information">', $txt['topicsolved_is_solved'], '</div>';]]></add> |
|
26 |
+ </operation> |
|
27 |
+ <operation> |
|
28 |
+ <search position="after"><![CDATA[// Restore topic. eh? No monkey business.]]></search> |
|
29 |
+ <add><![CDATA[// Topic solved. |
|
30 |
+ $mod_buttons = array_merge(array( |
|
31 |
+ 'solve' => array('test' => 'can_solve', 'text' => empty($context['is_solved']) ? 'solve_topic' : 'unsolve_topic', 'image' => empty($context['is_solved']) ? 'solve.gif' : 'unsolve.gif', 'lang' => true, 'url' => $scripturl . '?action=solve;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']), |
|
32 |
+ ),$mod_buttons);]]></add> |
|
33 |
+ </operation> |
|
34 |
+ </file> |
|
35 |
+ |
|
36 |
+ <!-- Source files --> |
|
37 |
+ <file name="$boarddir/index.php"> |
|
38 |
+ <operation> |
|
39 |
+ <search position="after"><![CDATA[// Get the function and file to include - if it's not there, do the board index.]]></search> |
|
40 |
+ <add><![CDATA[$actionArray['solve'] = array('SolveTopic.php', 'SolveTopic');]]></add> |
|
41 |
+ </operation> |
|
42 |
+ </file> |
|
43 |
+ <file name="$sourcedir/Display.php"> |
|
44 |
+ <operation> |
|
45 |
+ <search position="replace"><![CDATA[foreach ($anyown_permissions as $contextual => $perm) |
|
46 |
+ $context[$contextual] = allowedTo($perm . '_any') || ($context['user']['started'] && allowedTo($perm . '_own'));]]></search> |
|
47 |
+ <add><![CDATA[// Topic solved |
|
48 |
+ $anyown_permissions['can_solve'] = 'solve_topic'; |
|
49 |
+ |
|
50 |
+ foreach ($anyown_permissions as $contextual => $perm) |
|
51 |
+ $context[$contextual] = allowedTo($perm . '_any') || ($context['user']['started'] && allowedTo($perm . '_own')); |
|
52 |
+ |
|
53 |
+ // Topic solved. Is this one of THE boards? |
|
54 |
+ $context['board_solve'] = !empty($modSettings['topicsolved_board_' . $board]); |
|
55 |
+ $context['can_solve'] &= $context['board_solve']; |
|
56 |
+]]></add> |
|
57 |
+ </operation> |
|
58 |
+ <operation> |
|
59 |
+ <search position="before"><![CDATA[' . (!empty($modSettings['recycle_board']) && $modSettings['recycle_board'] == $board ? ', id_previous_board, id_previous_topic' : '') . ']]></search> |
|
60 |
+ <add><![CDATA[, t.solved]]></add> |
|
61 |
+ </operation> |
|
62 |
+ <operation> |
|
63 |
+ <search position="after"><![CDATA[// We don't want to show the poll icon in the topic class here, so pretend it's not one.]]></search> |
|
64 |
+ <add><![CDATA[// Topic solved |
|
65 |
+ $context['is_solved'] = $topicinfo['solved'];]]></add> |
|
66 |
+ </operation> |
|
67 |
+ </file> |
|
68 |
+ <file name="$sourcedir/Subs.php"> |
|
69 |
+ <operation> |
|
70 |
+ <search position="after"><![CDATA[if (!is_array($extra))]]></search> |
|
71 |
+ <add><![CDATA[// Solved log |
|
72 |
+ $log_types = array_merge($log_types,array('solve' => 4));]]></add> |
|
73 |
+ </operation> |
|
74 |
+ </file> |
|
75 |
+ <file name="$sourcedir/ModLog.php"> |
|
76 |
+ <operation> |
|
77 |
+ <search position="before"><![CDATA[isAllowedTo('admin_forum');]]></search> |
|
78 |
+ <add><![CDATA[// Topic solved log |
|
79 |
+ $context['log_type'] = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'solvelog' ? 4 : $context['log_type']; |
|
80 |
+ |
|
81 |
+ // Make sure the solve log is enabled. |
|
82 |
+ if($context['log_type'] == 4 && empty($modSettings['enable_solved_log'])) |
|
83 |
+ redirectexit('action=moderate');]]></add> |
|
84 |
+ </operation> |
|
85 |
+ <operation> |
|
86 |
+ <search position="after"><![CDATA[// The number of entries to show per page of log file.]]></search> |
|
87 |
+ <add><![CDATA[// Topic solved log: Override page_title and url_starts if required. |
|
88 |
+ if($context['log_type'] == 4) |
|
89 |
+ { |
|
90 |
+ $context['page_title'] = 'Solve log'; |
|
91 |
+ $context['url_start'] = '?action=moderate;area=modlog;sa=solvelog;type=4'; |
|
92 |
+ }]]></add> |
|
93 |
+ </operation> |
|
94 |
+ <operation> |
|
95 |
+ <search position="after"><![CDATA[// Create the watched user list.]]></search> |
|
96 |
+ <add><![CDATA[// Topic solved log: Override some list data before we create it. |
|
97 |
+ if($context['log_type'] == 4) |
|
98 |
+ { |
|
99 |
+ $listOptions['title'] = '<a href="' . $scripturl . '?action=helpadmin;help=solve_log_help" onclick="return reqWin(this.href);" class="help"><img src="' . $settings['images_url'] . '/helptopics.gif" alt="' . $txt['help'] . '" align="top" /></a> ' . $txt['modlog_solve_log']; |
|
100 |
+ $listOptions['additional_rows'][0]['value'] = $txt['modlog_solve_log_desc']; |
|
101 |
+ $listOptions['no_items_label'] = $txt['modlog_solve_log_no_entries_found']; |
|
102 |
+ }]]></add> |
|
103 |
+ </operation> |
|
104 |
+ </file> |
|
105 |
+ <file name="$sourcedir/Admin.php"> |
|
106 |
+ <operation> |
|
107 |
+ <search position="before"><![CDATA['pruning' => array($txt['pruning_title'], 'admin_forum'),]]></search> |
|
108 |
+ <add><![CDATA['solvelog' => array($txt['modlog_solve_log'], 'moderate_forum', 'enabled' => !empty($modSettings['enable_solved_log']), 'url' => $scripturl . '?action=moderate;area=modlog;sa=solvelog'),]]></add> |
|
109 |
+ </operation> |
|
110 |
+ <operation> |
|
111 |
+ <search position="before"><![CDATA[// Mod Authors for a "ADD AFTER" on this line. Ensure you end your change with a comma. For example:]]></search> |
|
112 |
+ <add><![CDATA[ |
|
113 |
+ 'topicsolved' => array($txt['topic_solved_title']),]]></add> |
|
114 |
+ </operation> |
|
115 |
+ </file> |
|
116 |
+ <file name="$sourcedir/ModerationCenter.php"> |
|
117 |
+ <operation> |
|
118 |
+ <search position="after"><![CDATA['notice' => array(]]></search> |
|
119 |
+ <add><![CDATA['solvelog' => array( |
|
120 |
+ 'enabled' => !empty($modSettings['enable_solved_log']), |
|
121 |
+ 'label' => $txt['modlog_solve_log'], |
|
122 |
+ 'file' => 'Modlog.php', |
|
123 |
+ 'function' => 'ViewModlog', |
|
124 |
+ 'custom_url' => $scripturl . '?action=moderate;area=modlog;sa=solvelog', |
|
125 |
+ ),]]></add> |
|
126 |
+ </operation> |
|
127 |
+ </file> |
|
128 |
+ <file name="$sourcedir/ManagePermissions.php"> |
|
129 |
+ <operation> |
|
130 |
+ <search position="before"><![CDATA[// All permission groups that will be shown in the left column on classic view. |
|
131 |
+]]></search> |
|
132 |
+ <add><![CDATA[$permissionList['board']['solve_topic'] = array(true, 'topic', 'moderate', 'moderate');]]></add> |
|
133 |
+ </operation> |
|
134 |
+ </file> |
|
135 |
+ <file name="$sourcedir/ManageSettings.php"> |
|
136 |
+ <operation> |
|
137 |
+ <search position="after"><![CDATA[// Mod authors, once again, if you have a whole section to add do it AFTER this line, and keep a comma at the end.]]></search> |
|
138 |
+ <add><![CDATA['topicsolved' => 'ModifyTopicSolvedSettings',]]></add> |
|
139 |
+ </operation> |
|
140 |
+ <operation> |
|
141 |
+ <search position="end" /> |
|
142 |
+ <add><![CDATA[// Topic solved mod |
|
143 |
+function ModifyTopicSolvedSettings($return_config = false) |
|
144 |
+{ |
|
145 |
+ global $txt, $scripturl, $context, $settings, $sc, $modSettings, $smcFunc; |
|
146 |
+ |
|
147 |
+ $query = $smcFunc['db_query']('', ' |
|
148 |
+ SELECT id_board, id_cat, child_level, name FROM {db_prefix}boards ORDER BY board_order ASC |
|
149 |
+ '); |
|
150 |
+ |
|
151 |
+ $config_vars = array(); |
|
152 |
+ $last = -1; |
|
153 |
+ |
|
154 |
+ $config_vars[] = array('check', 'enable_solved_log'); |
|
155 |
+ $config_vars[] = array('check', 'topicsolved_highlight'); |
|
156 |
+ $config_vars[] = array('text', 'topicsolved_highlight_col1', 'size' => 10, 'disabled' => empty($modSettings['topicsolved_highlight'])); |
|
157 |
+ $config_vars[] = array('text', 'topicsolved_highlight_col2', 'size' => 10, 'disabled' => empty($modSettings['topicsolved_highlight'])); |
|
158 |
+ $config_vars[] = array('check', 'topicsolved_display_notice'); |
|
159 |
+ $config_vars[] = ''; |
|
160 |
+ $config_vars[] = array('message', 'topicsolved_board_desc'); |
|
161 |
+ |
|
162 |
+ while($row = $smcFunc['db_fetch_assoc']($query)) { |
|
163 |
+ if($row['id_cat'] != $last && $last != -1) { |
|
164 |
+ $config_vars[] = ''; |
|
165 |
+ } |
|
166 |
+ $board_id = 'topicsolved_board_' . $row['id_board']; |
|
167 |
+ $txt[$board_id] = (($row['child_level'] > 0) ? str_repeat(' ', $row['child_level']) : '') . $row['name']; |
|
168 |
+ $config_vars[] = array('check', $board_id); |
|
169 |
+ $last = $row['id_cat']; |
|
170 |
+ } |
|
171 |
+ |
|
172 |
+ $smcFunc['db_free_result']($query); |
|
173 |
+ |
|
174 |
+ if ($return_config) |
|
175 |
+ return $config_vars; |
|
176 |
+ |
|
177 |
+ $context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=topicsolved'; |
|
178 |
+ $context['settings_title'] = $txt['topic_solved_title']; |
|
179 |
+ |
|
180 |
+ // Saving? |
|
181 |
+ if (isset($_GET['save'])) |
|
182 |
+ { |
|
183 |
+ checkSession(); |
|
184 |
+ |
|
185 |
+ $save_vars = $config_vars; |
|
186 |
+ saveDBSettings($save_vars); |
|
187 |
+ |
|
188 |
+ redirectexit('action=admin;area=modsettings;sa=topicsolved'); |
|
189 |
+ } |
|
190 |
+ |
|
191 |
+ prepareDBSettingContext($config_vars); |
|
192 |
+}]]></add> |
|
193 |
+ </operation> |
|
194 |
+ </file> |
|
195 |
+ <file name="$sourcedir/MessageIndex.php"> |
|
196 |
+ <operation> |
|
197 |
+ <search position="after"><![CDATA[determineTopicClass($context['topics'][$row['id_topic']]);]]></search> |
|
198 |
+ <add><![CDATA[// Topic solved highlighting, if enabled. |
|
199 |
+ $context['topics'][$row['id_topic']]['is_solved'] = $context['board_solve'] && !empty($row['solved']); |
|
200 |
+ ]]></add> |
|
201 |
+ </operation> |
|
202 |
+ <operation> |
|
203 |
+ <search position="before"><![CDATA[SUBSTRING(mf.body, 1, 385) AS first_body, ml.smileys_enabled AS last_smileys, mf.smileys_enabled AS first_smileys]]></search> |
|
204 |
+ <add><![CDATA[, t.solved]]></add> |
|
205 |
+ </operation> |
|
206 |
+ <operation> |
|
207 |
+ <search position="after"><![CDATA[// Begin 'printing' the message index for current board.]]></search> |
|
208 |
+ <add><![CDATA[// Is this board solvable? |
|
209 |
+ $context['board_solve'] = !empty($modSettings['topicsolved_board_' . $board]); |
|
210 |
+ if (!empty($modSettings['topicsolved_highlight'])) |
|
211 |
+ { |
|
212 |
+ if (!empty($modSettings['topicsolved_highlight_col1']) && !empty($modSettings['topicsolved_highlight_col2'])) |
|
213 |
+ { |
|
214 |
+ if (empty($context['html_headers'])) |
|
215 |
+ $context['html_headers'] = ''; |
|
216 |
+ $context['html_headers'] .= '<style type="text/css">/* Topic solved */ .solvedbg { background:' . $modSettings['topicsolved_highlight_col1'] . '; } .solvedbg2 { background:' . $modSettings['topicsolved_highlight_col2'] . '; }</style>'; |
|
217 |
+ } |
|
218 |
+ } |
|
219 |
+ |
|
220 |
+ ]]></add> |
|
221 |
+ </operation> |
|
222 |
+ </file> |
|
223 |
+ |
|
224 |
+</modification> |
|
0 | 225 |
\ No newline at end of file |
... | ... |
@@ -0,0 +1,23 @@ |
1 |
+<?xml version="1.0"?> |
|
2 |
+<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info"> |
|
3 |
+<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/"> |
|
4 |
+ <id>SimpleDesk:Topic_Solved_Mod</id> |
|
5 |
+ <name>Topic Solved Mod</name> |
|
6 |
+ <version>1.0</version> |
|
7 |
+ <type>modification</type> |
|
8 |
+ <install for="2.0-2.99.99"> |
|
9 |
+ <readme type="file" parsebbc="true">readme.txt</readme> |
|
10 |
+ <modification>install2.0.xml</modification> |
|
11 |
+ <modification>english.xml</modification> |
|
12 |
+ <require-file name="SolveTopic.php" destination="$sourcedir" /> |
|
13 |
+ <require-file name="solved.gif" destination="$imagesdir/post" /> |
|
14 |
+ <database>install.php</database> |
|
15 |
+ </install> |
|
16 |
+ <uninstall for="2.0-2.99.99"> |
|
17 |
+ <readme type="inline">This will uninstall the Topic Solved Mod. Thanks for using this customization.</readme> |
|
18 |
+ <modification reverse="true">install2.0.xml</modification> |
|
19 |
+ <modification reverse="true">english.xml</modification> |
|
20 |
+ <remove-file name="$sourcedir/SolveTopic.php" /> |
|
21 |
+ <remove-file name="$imagesdir/post/solved.gif" /> |
|
22 |
+ </uninstall> |
|
23 |
+</package-info> |
|
0 | 24 |
\ No newline at end of file |