Skip to content

Commit

Permalink
Display "no data" warning on the page
Browse files Browse the repository at this point in the history
Previously, the plugin was using an inline javascript to display a
pop-up alert message and then redirect to my view page.

With CSP enabled by default in Mantis 2.x, the inline script was blocked
so this feature was no longer working as expected.

Fixes #21
  • Loading branch information
dregad committed Sep 8, 2019
1 parent 4e2652b commit 8ac1c1c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions lang/strings_english.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ $s_plugin_GaugeSupport_ASPU_abbr = 'ASPU';
$s_plugin_GaugeSupport_ASPU_label = 'Average Support per User';
$s_plugin_GaugeSupport_show_all_pos = '» Show all {project} issues, highest-supported first';
$s_plugin_GaugeSupport_show_all_neg = '» Show all {project} issues, lowest-supported first';
$s_plugin_GaugeSupport_no_data = 'There is not enough data to generate a report.';
23 changes: 18 additions & 5 deletions pages/issue_ranking.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@
// echo "<p>$dbquery</p>";
//die();
$dboutput = db_query($dbquery);
$noOfRowsWeGot = db_num_rows($dboutput);
if ($noOfRowsWeGot==0){
echo "<script>alert('There is not enough data to generate a report');window.location='my_view_page.php';</script>";
}

$resultset = array();
// load listable issues into array
while($row = db_fetch_array($dboutput)) {
Expand Down Expand Up @@ -87,6 +84,20 @@
<div class="widget-body">
<div class="widget-main no-padding">

<?php
if( empty( $resultset ) ) {
?>
<div class="container-fluid">
<br>
<div class="alert alert-warning center">
<?php echo plugin_lang_get( 'no_data' ); ?>
</div>
&nbsp;
</div>
<?php
} else {
?>

<div class="table-responsive">
<div class="widget-toolbox padding-8 clearfix">
<a class="btn btn-primary btn-white btn-round "
Expand Down Expand Up @@ -123,7 +134,9 @@
?>
</table>
</div>

<?php
} # if empty result set
?>
</div>
</div>
</div>
Expand Down

0 comments on commit 8ac1c1c

Please sign in to comment.