de5144a5584eb5d60f2b288dbe2d44e228bbbfe8
nas ! Added /team_mods/ back to...

nas authored 13 years ago

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>
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

10) 			<search position="before"><![CDATA[// Some columns require a different shade of the color class.]]></search>
11) 			<add><![CDATA[
12) 			if (!empty($topic['is_solved']))
13) 				$color_class .= ' solvedbg';]]></add>
nas ! Added /team_mods/ back to...

nas authored 13 years ago

14) 		</operation>
15) 	</file>
16) 
17) 	<!-- Source files -->		
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

18) 	<file name="$boarddir/index.php"><!-- Adding the action. While it would be nice to use a hook, I don't want to include a file every page load for the sake of this one change. -->	
nas ! Added /team_mods/ back to...

nas authored 13 years ago

19) 		<operation>
20) 			<search position="after"><![CDATA[// Get the function and file to include - if it's not there, do the board index.]]></search>
21) 			<add><![CDATA[$actionArray['solve'] = array('SolveTopic.php', 'SolveTopic');]]></add>
22) 		</operation>
23) 	</file>
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

24) 	<file name="$sourcedir/Display.php"><!-- Lots to change, notably figuring out the permission for adding the button, plus loading all sorts of other stuff. -->
nas ! Added /team_mods/ back to...

nas authored 13 years ago

25) 		<operation>
26) 			<search position="replace"><![CDATA[foreach ($anyown_permissions as $contextual => $perm)
27) 		$context[$contextual] = allowedTo($perm . '_any') || ($context['user']['started'] && allowedTo($perm . '_own'));]]></search>
28) 			<add><![CDATA[// Topic solved
29) 	$anyown_permissions['can_solve'] = 'solve_topic';
30) 	
31) 	foreach ($anyown_permissions as $contextual => $perm)
32) 		$context[$contextual] = allowedTo($perm . '_any') || ($context['user']['started'] && allowedTo($perm . '_own'));
33) 		
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

34) 	// Topic solved stuff. Is this one of THE boards?
35) 	loadTemplate('SolveTopic-Display');
nas ! Added /team_mods/ back to...

nas authored 13 years ago

36) 	$context['board_solve'] = !empty($modSettings['topicsolved_board_' . $board]);
37) 	$context['can_solve'] &= $context['board_solve'];
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

38) 	if (!empty($modSettings['topicsolved_display_notice']) && $context['is_solved'] && $context['board_solve'])
39) 		$context['template_layers'][] = 'topicsolved_header';
nas ! Added /team_mods/ back to...

nas authored 13 years ago

40) ]]></add>
41) 		</operation>
42) 		<operation>
43) 			<search position="before"><![CDATA[' . (!empty($modSettings['recycle_board']) && $modSettings['recycle_board'] == $board ? ', id_previous_board, id_previous_topic' : '') . ']]></search>
44) 			<add><![CDATA[, t.solved]]></add>
45) 		</operation>	
46) 		<operation>
47) 			<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>
48) 			<add><![CDATA[// Topic solved
49) 	$context['is_solved'] = $topicinfo['solved'];]]></add>
50) 		</operation>		
51) 	</file>	
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

52) 	<file name="$sourcedir/Subs.php"><!-- Add the topic solved log to the list of possible log types we can handle. -->
nas ! Added /team_mods/ back to...

nas authored 13 years ago

53) 		<operation>
54) 			<search position="after"><![CDATA[if (!is_array($extra))]]></search>
55) 			<add><![CDATA[// Solved log
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

56) 	$log_types['solve'] = 4;]]></add>
nas ! Added /team_mods/ back to...

nas authored 13 years ago

57) 		</operation>	
58) 	</file>		
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

59) 	<file name="$sourcedir/Modlog.php"><!-- Extend the moderation log to support the topic solving too. -->
nas ! Added /team_mods/ back to...

nas authored 13 years ago

60) 		<operation>
61) 			<search position="before"><![CDATA[isAllowedTo('admin_forum');]]></search>
62) 			<add><![CDATA[// Topic solved log
63) 	$context['log_type'] = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'solvelog' ? 4 : $context['log_type'];
64) 	
65) 	// Make sure the solve log is enabled.
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

66) 	if ($context['log_type'] == 4 && empty($modSettings['enable_solved_log']))
nas ! Added /team_mods/ back to...

nas authored 13 years ago

67) 		redirectexit('action=moderate');]]></add>
68) 		</operation>
69) 		<operation>
70) 			<search position="after"><![CDATA[// The number of entries to show per page of log file.]]></search>
71) 			<add><![CDATA[// Topic solved log: Override page_title and url_starts if required.
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

72) 	if ($context['log_type'] == 4)
nas ! Added /team_mods/ back to...

nas authored 13 years ago

73) 	{
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

74) 		$context['page_title'] = $txt['modlog_solve_log'];	
nas ! Added /team_mods/ back to...

nas authored 13 years ago

75) 		$context['url_start'] = '?action=moderate;area=modlog;sa=solvelog;type=4';		
76) 	}]]></add>
77) 		</operation>	
78) 		<operation>
79) 			<search position="after"><![CDATA[// Create the watched user list.]]></search>
80) 			<add><![CDATA[// Topic solved log: Override some list data before we create it.
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

81) 	if ($context['log_type'] == 4)
nas ! Added /team_mods/ back to...

nas authored 13 years ago

82) 	{
83) 		$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'];
84) 		$listOptions['additional_rows'][0]['value'] = $txt['modlog_solve_log_desc'];
85) 		$listOptions['no_items_label'] = $txt['modlog_solve_log_no_entries_found'];
86) 	}]]></add>
87) 		</operation>		
88) 	</file>	
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

89) 	<file name="$sourcedir/ModerationCenter.php"><!-- Provide access from the moderation center to the moderation log for topic solving. -->
nas ! Added /team_mods/ back to...

nas authored 13 years ago

90) 		<operation>
91) 			<search position="after"><![CDATA['notice' => array(]]></search>
92) 			<add><![CDATA['solvelog' => array(
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

93) 					'enabled' => !empty($modSettings['enable_solved_log']) && in_array('ml', $context['admin_features']),
nas ! Added /team_mods/ back to...

nas authored 13 years ago

94) 					'label' => $txt['modlog_solve_log'],
95) 					'file' => 'Modlog.php',
96) 					'function' => 'ViewModlog',
97) 					'custom_url' => $scripturl . '?action=moderate;area=modlog;sa=solvelog',
98) 				),]]></add>
99) 		</operation>	
100) 	</file>	
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

101) 	<file name="$sourcedir/MessageIndex.php"><!-- Be sure to get the topic data, to be able to display whether something is solved or not. -->
nas ! Added /team_mods/ back to...

nas authored 13 years ago

102) 		<operation>
103) 			<search position="after"><![CDATA[determineTopicClass($context['topics'][$row['id_topic']]);]]></search>
104) 			<add><![CDATA[// Topic solved highlighting, if enabled.
105) 			$context['topics'][$row['id_topic']]['is_solved'] = $context['board_solve'] && !empty($row['solved']);
106) 			]]></add>
107) 		</operation>
108) 		<operation>
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

109) 			<search position="before"><![CDATA[mf.smileys_enabled AS first_smileys]]></search>
nas ! Added /team_mods/ back to...

nas authored 13 years ago

110) 			<add><![CDATA[, t.solved]]></add>
111) 		</operation>
112) 		<operation>
113) 			<search position="after"><![CDATA[// Begin 'printing' the message index for current board.]]></search>
114) 			<add><![CDATA[// Is this board solvable?
115) 		$context['board_solve'] = !empty($modSettings['topicsolved_board_' . $board]);
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

116) 		if (!empty($modSettings['topicsolved_highlight']) && !empty($modSettings['topicsolved_highlight_col1']) && !empty($modSettings['topicsolved_highlight_col2']))
nas ! Added /team_mods/ back to...

nas authored 13 years ago

117) 		{
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

118) 			if (empty($context['html_headers']))
119) 				$context['html_headers'] = '';
120) 			$context['html_headers'] .= '<style type="text/css">/* Topic solved */ .solvedbg { background:' . $modSettings['topicsolved_highlight_col1'] . '; } .solvedbg2 { background:' . $modSettings['topicsolved_highlight_col2'] . '; }</style>';
nas ! Added /team_mods/ back to...

nas authored 13 years ago

121) 		}
122) 
123) 		]]></add>
124) 		</operation>
gruffen [Topic solved] Some stuff I...

gruffen authored 12 years ago

125) 	</file>
126) 	<file name="$boarddir/SSI.php"><!-- Make sure the topic solved icon is actually added to the SSI functions too. Same code, used twice. -->
127) 		<operation>
128) 			<search position="replace"><![CDATA[$stable_icons = array('xx']]></search>
129) 			<add><![CDATA[$stable_icons = array('solved', 'xx']]></add>
130) 		</operation>
131) 		<operation>
132) 			<search position="replace"><![CDATA[$stable_icons = array('xx']]></search>
133) 			<add><![CDATA[$stable_icons = array('solved', 'xx']]></add>
134) 		</operation>
135) 	</file>