Getting Mantis 1.1.0a2 to play nice with mod_proxy_html

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
srouleau
Posts: 16
Joined: 03 Aug 2005, 02:30

Getting Mantis 1.1.0a2 to play nice with mod_proxy_html

Post by srouleau »

I'm moving our Mantis installation to another server, which will be called by another Apache2 webserver (typical reverse proxy setup behind a NAT firewall it seems).

When I would enable mod_proxy_html I would get an extra linebreak on the summary pages (with jpgraph enabled).

After testing the output of summary_graph.php with xmllint, the same extra linebreak, actually caused by a <p> which is addded to wrap the first "|" marker of the menu bar, with the last.

The fix is relatively trivial, but if you want to make it look 'nice' (ie: no extra whitespaces) it's a bit more involved:

1) Prevent the <p>..</p> by wrapping the menu within a <div>:

core/html_api.php:

Code: Select all

function print_menu_graph() {
    if ( config_get( 'use_jpgraph' ) ) {
       $t_icon_path = config_get( 'icon_path' );

       PRINT '<br /><div align="left">';
       PRINT '<a href="summary_page.php"><img src="' . $t_icon_path.'synthese.gif" border="0" align="center" />' . lang_get( 'synthesis_link' ) . '</a> | ';
       PRINT '<a href="summary_graph_imp_status.php"><img src="' . $t_icon_path.'synthgraph.gif" border="0" align="center" />' . lang_get( 'status_link' ) . '</a> | ';
       PRINT '<a href="summary_graph_imp_priority.php"><img src="' . $t_icon_path.'synthgraph.gif" border="0" align="center" />' . lang_get( 'priority_link' ) . '</a> | ';
       PRINT '<a href="summary_graph_imp_severity.php"><img src="' . $t_icon_path.'synthgraph.gif" border="0" align="center" />' . lang_get( 'severity_link' ) . '</a> | ';
       PRINT '<a href="summary_graph_imp_category.php"><img src="' . $t_icon_path.'synthgraph.gif" border="0" align="center" />' . lang_get( 'category_link' ) . '</a> | ';
       PRINT '<a href="summary_graph_imp_resolution.php"><img src="' . $t_icon_path.'synthgraph.gif" border="0" align="center" />' . lang_get( 'resolution_link' ) . '</a></div>';
    }
}
2) Remove extra whitespaces (this is a matter of preference, really)

summary_graph.php:

Remove the <br /> after the call to print_menu_graph(); (There's only one), and before the call to print_summary_menu(). If you want this extra space before the summary_menu, then adjust the summary_graph_imp* files below accordingly by moving the <br /> up two lines rather than deleting it.

summary_graph_imp_*.php:

a) Remove the <br /> inserted between the summary_page menu and menu_graph:

print_summary_menu( 'summary_page.php' );
echo '<br />'; <<--- remove this

b) Remove the <br /> before the start of the main table (which is actually the <br /> inserted after the call to print_menu_graph(), as above.

?>

<br /> <<--- delete this
<table class="width100" cellspacing="1">
<tr>
<td class="form-title">

That's it. Hmm, guess I better start tracking these changes under our SCM, too. :)

Steph
srouleau
Posts: 16
Joined: 03 Aug 2005, 02:30

Post by srouleau »

If someone else ever wants to do the same thing, in the end I had to get mantis server through mod_proxy, but not mod_proxy_html. There were too many tiny HTML coding errors (which the HTMLTidy Firefox plugin shows, too). Annoyingly mod_proxy would try to fix them, which would break a bunch of things, especially the AJAX filters.

The way I have it setup now, I can still make it go through a reversed proxy, there's just no link rewriting required.
Post Reply