Tweaked ChangeLog (example and demo)

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
marco.wobben
Posts: 4
Joined: 08 Jan 2016, 08:47

Tweaked ChangeLog (example and demo)

Post by marco.wobben »

I've wondered how to show visitors the difference between news, changes and fixes on the changelog pages. I've come up with the following adjustments:

Adjust the Query in "changelog_page.php" (approx. line 175) to implement a differen ordering:

Code: Select all

		$query = "SELECT sbt.*, dbt.fixed_in_version AS parent_version, rt.source_bug_id
			FROM $t_bug_table AS sbt
			LEFT JOIN $t_relation_table AS rt
				ON sbt.id=rt.destination_bug_id AND rt.relationship_type=" . BUG_DEPENDANT . "
			LEFT JOIN $t_bug_table AS dbt ON dbt.id=rt.source_bug_id
			WHERE sbt.project_id=" . db_param() . "
			  AND sbt.fixed_in_version=" . db_param() . "
			ORDER BY sbt.severity ASC, sbt.status ASC, sbt.last_updated DESC"; /* INSERTED SEVERITY AS THE FIRST ORDERING ARGUMENT */
Secondly alter the "custom_function_default_changelog_print_issue" function in the file "core/custom_fucntion_api.php" (approx. line 58):

Code: Select all

    switch ($t_bug->severity) {
        case 10: // feature
            $t_severity = '<img src="/imgs/new16.png" title="New"/>';
            break;
        case 20: // trivial
        case '30': // text
        case '40': // tweak
            $t_severity = '<img src="/imgs/hint16.png" title="Change"/>';
            break;

        case '50': // minor
        case '60': // major
        case '70': // crash
        case '80': // block
            $t_severity = "Fix";
            $t_severity = '<img src="/imgs/error16.png" title="Fix"/>';
            break;
        default:
            $t_severity = "";
    }
	$t_category = is_blank( $t_category_name ) ? '' : '<b>[' . string_display_line( $t_category_name ) . ']</b> ';
	echo utf8_str_pad( '', $p_issue_level * 6, '&#160;' ), $t_severity . ' ', string_get_bug_view_link( $p_issue_id ), ': ', $t_category, string_display_line_links( $t_bug->summary );
This would render (given you've uploaded some icons) as our pages would look:

http://bugs.casetalk.net/changelog_page.php

Regards,
Marco.
atrol
Site Admin
Posts: 8375
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Tweaked ChangeLog (example and demo)

Post by atrol »

marco.wobben wrote: Secondly alter the "custom_function_default_changelog_print_issue" function in the file "core/custom_fucntion_api.php" (approx. line 58):
You don't have to touch any existing code for it.
There are so called custom functions for it https://www.mantisbt.org/docs/master-1. ... USTOMFUNCS
Please use Search before posting and read the Manual
marco.wobben
Posts: 4
Joined: 08 Jan 2016, 08:47

Re: Tweaked ChangeLog (example and demo)

Post by marco.wobben »

Ok, I see now. The change of the "default" custom function could have been arranged using a "override" custom function.

Yet to alter the ordering of the sql query, I don't any other option than to tweak the original code. Or am I overlooking something? :?
atrol
Site Admin
Posts: 8375
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Tweaked ChangeLog (example and demo)

Post by atrol »

marco.wobben wrote:Yet to alter the ordering of the sql query, I don't any other option than to tweak the original code. Or am I overlooking something? :?
It is possible, but hardly worth the effort.
You could copy the whole changelog_page.php script, change it the way you want and add a new menu entry for your own change log.
Please use Search before posting and read the Manual
Post Reply