SleePy Public Git Projects
Repositories
Main Site
GitHub Profile
SD-Team-Mods-TopicSolved
Code
Commits
Branches
Tags
Search
Tree:
ee2522a
Branches
Tags
master
SD-Team-Mods-TopicSolved
install
install2.0.xml
2.1 RC3 support Cleanup of files 2.1 does not use modifications language, but a dedicated language file
jdarwood007
commited
ee2522a
at 2020-11-01 10:20:18
install2.0.xml
Blame
History
Raw
<?xml version="1.0"?> <!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification"> <modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/"> <id>SimpleDesk:Topic_Solved_Mod</id> <version>1.0</version> <!-- Template files --> <file name="$themedir/MessageIndex.template.php"> <operation> <search position="before"><![CDATA[// Some columns require a different shade of the color class.]]></search> <add><![CDATA[ if (!empty($topic['is_solved'])) $color_class .= ' solvedbg';]]></add> </operation> </file> <!-- Source files --> <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. --> <operation> <search position="after"><![CDATA[// Get the function and file to include - if it's not there, do the board index.]]></search> <add><![CDATA[$actionArray['solve'] = array('SolveTopic.php', 'SolveTopic');]]></add> </operation> </file> <file name="$sourcedir/Display.php"><!-- Lots to change, notably figuring out the permission for adding the button, plus loading all sorts of other stuff. --> <operation> <search position="replace"><![CDATA[foreach ($anyown_permissions as $contextual => $perm) $context[$contextual] = allowedTo($perm . '_any') || ($context['user']['started'] && allowedTo($perm . '_own'));]]></search> <add><![CDATA[// Topic solved $anyown_permissions['can_solve'] = 'solve_topic'; foreach ($anyown_permissions as $contextual => $perm) $context[$contextual] = allowedTo($perm . '_any') || ($context['user']['started'] && allowedTo($perm . '_own')); // Topic solved stuff. Is this one of THE boards? loadTemplate('SolveTopic-Display'); $context['board_solve'] = !empty($modSettings['topicsolved_board_' . $board]); $context['can_solve'] &= $context['board_solve']; if (!empty($modSettings['topicsolved_display_notice']) && $context['is_solved'] && $context['board_solve']) $context['template_layers'][] = 'topicsolved_header'; ]]></add> </operation> <operation> <search position="before"><![CDATA[' . (!empty($modSettings['recycle_board']) && $modSettings['recycle_board'] == $board ? ', id_previous_board, id_previous_topic' : '') . ']]></search> <add><![CDATA[, t.solved]]></add> </operation> <operation> <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> <add><![CDATA[// Topic solved $context['is_solved'] = $topicinfo['solved'];]]></add> </operation> </file> <file name="$sourcedir/Subs.php"><!-- Add the topic solved log to the list of possible log types we can handle. --> <operation> <search position="after"><![CDATA[if (!is_array($extra))]]></search> <add><![CDATA[// Solved log $log_types['solve'] = 4;]]></add> </operation> </file> <file name="$sourcedir/Modlog.php"><!-- Extend the moderation log to support the topic solving too. --> <operation> <search position="before"><![CDATA[isAllowedTo('admin_forum');]]></search> <add><![CDATA[// Topic solved log $context['log_type'] = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'solvelog' ? 4 : $context['log_type']; // Make sure the solve log is enabled. if ($context['log_type'] == 4 && empty($modSettings['enable_solved_log'])) redirectexit('action=moderate');]]></add> </operation> <operation> <search position="after"><![CDATA[// The number of entries to show per page of log file.]]></search> <add><![CDATA[// Topic solved log: Override page_title and url_starts if required. if ($context['log_type'] == 4) { $context['page_title'] = $txt['modlog_solve_log']; $context['url_start'] = '?action=moderate;area=modlog;sa=solvelog;type=4'; }]]></add> </operation> <operation> <search position="after"><![CDATA[// Create the watched user list.]]></search> <add><![CDATA[// Topic solved log: Override some list data before we create it. if ($context['log_type'] == 4) { $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']; $listOptions['additional_rows'][0]['value'] = $txt['modlog_solve_log_desc']; $listOptions['no_items_label'] = $txt['modlog_solve_log_no_entries_found']; }]]></add> </operation> </file> <file name="$sourcedir/ModerationCenter.php"><!-- Provide access from the moderation center to the moderation log for topic solving. --> <operation> <search position="after"><![CDATA['notice' => array(]]></search> <add><![CDATA['solvelog' => array( 'enabled' => !empty($modSettings['enable_solved_log']) && in_array('ml', $context['admin_features']), 'label' => $txt['modlog_solve_log'], 'file' => 'Modlog.php', 'function' => 'ViewModlog', 'custom_url' => $scripturl . '?action=moderate;area=modlog;sa=solvelog', ),]]></add> </operation> </file> <file name="$sourcedir/MessageIndex.php"><!-- Be sure to get the topic data, to be able to display whether something is solved or not. --> <operation> <search position="after"><![CDATA[determineTopicClass($context['topics'][$row['id_topic']]);]]></search> <add><![CDATA[// Topic solved highlighting, if enabled. $context['topics'][$row['id_topic']]['is_solved'] = $context['board_solve'] && !empty($row['solved']); ]]></add> </operation> <operation> <search position="before"><![CDATA[mf.smileys_enabled AS first_smileys]]></search> <add><![CDATA[, t.solved]]></add> </operation> <operation> <search position="after"><![CDATA[// Begin 'printing' the message index for current board.]]></search> <add><![CDATA[// Is this board solvable? $context['board_solve'] = !empty($modSettings['topicsolved_board_' . $board]); if (!empty($modSettings['topicsolved_highlight']) && !empty($modSettings['topicsolved_highlight_col1']) && !empty($modSettings['topicsolved_highlight_col2'])) { if (empty($context['html_headers'])) $context['html_headers'] = ''; $context['html_headers'] .= '<style type="text/css">/* Topic solved */ .solvedbg { background:' . $modSettings['topicsolved_highlight_col1'] . '; } .solvedbg2 { background:' . $modSettings['topicsolved_highlight_col2'] . '; }</style>'; } ]]></add> </operation> </file> <file name="$boarddir/SSI.php"><!-- Make sure the topic solved icon is actually added to the SSI functions too. Same code, used twice. --> <operation> <search position="replace"><![CDATA[$stable_icons = array('xx']]></search> <add><![CDATA[$stable_icons = array('solved', 'xx']]></add> </operation> <operation> <search position="replace"><![CDATA[$stable_icons = array('xx']]></search> <add><![CDATA[$stable_icons = array('solved', 'xx']]></add> </operation> </file> </modification>