Page 1 of 1

[solved] Change / modify issue / bug lists HTML with plugin or so?

Posted: 29 Sep 2020, 16:25
by Tagirijus
Hey there (again and again),

again, like in my other recent threads, I want to customize MantisBT without the need to change core files. I know how to change this thing with modifying the core files, but my question here is: if it is possible (and how) to do it with configuration or plugins only:

I want the bug / issue list to have a hyperlink to the issue on the summary text.


I did it by modifying the columns_api.php and the function print_column_summary by changing the line:

Code: Select all

echo '<td class="column-summary">' . $t_summary . '</td>';
to

Code: Select all

echo '<td class="column-summary"><a href="view.php?id=' . $p_bug->id . '">' . $t_summary . '</a></td>';

Another thing is that I'd like to have a link to the "all projects" next to the category. For that I modified the columns_api.php again and changed the function print_column_category_id this way:


This block:

Code: Select all

# type project name if viewing 'all projects' or if issue is in a subproject
	if( ON == config_get( 'show_bug_project_links' ) && helper_get_current_project() != $p_bug->project_id ) {
		echo '<span class="small project">[';
		print_view_bug_sort_link( string_display_line( $t_project_name ), 'project_id', $t_sort, $t_dir, $p_columns_target );
		echo ']</span>&#160;&#160;';
	}

to this:

Code: Select all

# type project name if viewing 'all projects' or if issue is in a subproject
	if( ON == config_get( 'show_bug_project_links' ) && helper_get_current_project() != $p_bug->project_id ) {
		echo '<span class="small project">[';
		print_view_bug_sort_link( string_display_line( $t_project_name ), $p_bug->project_id, $t_sort, $t_dir, $p_columns_target );
		echo ']</span>&#160;&#160;';
	} else {
		echo '<span class="small project">[';
		print_view_bug_sort_link( string_display_line( 'All' ), '0', $t_sort, $t_dir, $p_columns_target );
		echo ']</span>&#160;&#160;';
	}
Can these things be done with anything in the config (e.g. custom_functions or so? I do not understand them at all, unfortunately ... :( ) or at least with a plugin (at all!?) and if so: how?

Re: Change / modify issue / bug lists HTML with plugin or so?

Posted: 30 Sep 2020, 20:17
by Tagirijus
Okay, I finally started to manage this as well (like my other threads, yeah!). It is now possible to get a new kind of column with my recently created "MantisBTTagiWorkflow" plugin. Regarding this thread here, the plugin will add (if this option is enabled) a new column "mantisbttagiworkflow_summary_linked" to the available columns. This is basically the "summary" column but with the text as a hyperlink to the related issue. You have to enable the plugin, the option and then add the above mentioned new column in the columns in the manage page. For the entry view I replaced the "summary" column with my plugins column and it works like a charme!

As a next step I will try either accomplish the other issue in a similar way, if even needed ... or not, I wil see. Hopefully someone will find my plugin useful as well, or at least - and this is more important - useful as a learning base, because ... well, I have to say it: the MantisBT API docs etc. are cruel and the code is so unbelievable unstructured and unorganized. It was a real pain to dig through the principles and I guess that I even did not understand he most things yet. :D

Re: Change / modify issue / bug lists HTML with plugin or so?

Posted: 03 Oct 2020, 17:29
by atrol
Tagirijus wrote: 30 Sep 2020, 20:17 I have to say it: the MantisBT API docs etc. are cruel and the code is so unbelievable unstructured and unorganized. It was a real pain to dig through the principles and I guess that I even did not understand he most things yet. :D
MantisBT is open source, driven by community, no one is paid for working on it.
Every helping hand is welcome. Maybe you want to fork the repository on GitHub and send pull requests to enhance the product / documentation.

Re: Change / modify issue / bug lists HTML with plugin or so?

Posted: 03 Oct 2020, 19:47
by Tagirijus
atrol wrote: 03 Oct 2020, 17:29 Every helping hand is welcome. Maybe you want to fork the repository on GitHub and send pull requests to enhance the product / documentation.
I also thought about that! At least helping with the docs or providing some examples for plugin development out of my experience. I'll keep it in mind and see when I find time for it.

Re: [solved] Change / modify issue / bug lists HTML with plugin or so?

Posted: 04 Oct 2020, 07:45
by cas
see when I find time for it.
This is mostly the problem.
code is so unbelievable unstructured and unorganized
I disagree here. You are new to Mantisbt so need to l"learn" how it is working. You will find overtime that is less unstructured and unorganized than you feel right now :mrgreen:
So keep on learning :D

Re: [solved] Change / modify issue / bug lists HTML with plugin or so?

Posted: 05 Oct 2020, 12:53
by Tagirijus
cas wrote: 04 Oct 2020, 07:45
code is so unbelievable unstructured and unorganized
I disagree here. You are new to Mantisbt so need to l"learn" how it is working. You will find overtime that is less unstructured and unorganized than you feel right now :mrgreen:
So keep on learning :D
Well, sorry for offtopic and also I am no professional developer, yes, but:
1. If a code has to be learned that hard, it is not intuitive and thus not structured or well organized to me.
2. HTML and PHP mixed in one PHP file? I call this not organized neither.

Background story: one or two years ago I started a project. I coded a whole catalogue raisonné (or is it called "catalogue of works"?) to keep track of all details of my compositions, sounds, productions, etc. It took me hundreds of hours and I had a little help from a professional coder, who at least lead me to some kind of "better organization of code" (he fixed some functions and gave me some keywords from time to time ... 99% of all the work was still done by me, hehe). After a year I had to fix things and in the last days I also started to do some fixes and feature improvements again - I am still understanding my code, even if the last time was a year apart. Well: yes, it is MY code so it is more obvious that I can understand it. But still: I have some old python scripts on my netbook, which I absolutely do not understand anymore, due to a bad code organization etc., haha. :D

Also it just feels to me that a lot is done by simply organizing things like: saving files to (logical sounding) folders, keeping the code logic and GUI separated and keeping methods and functions as small as possible. With the MantisBT it does not feel like these things were done that good, at least to me, unfortunately.

This should not become a rant or something! In the end MantisBT just works great and somehow I am sure that things are coded more clean (logical wise) and more clever than I could ever do it, haha. I am a hobby coder after all! I just want to make a point that structured and organized code is something else to me than it is in MantisBTs code right now. ;)