Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5fd657c
Showing
9 changed files
with
631 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
class GaugeSupportPlugin extends MantisPlugin { | ||
function register() { | ||
$this->name = 'Gauge Issue Support'; | ||
$this->description = 'This plugin gives community members the option to vote for higher or lower development priority of an issue.'; | ||
$this->page = 'config'; | ||
$this->version = '2.02'; | ||
$this->requires = array( | ||
'MantisCore' => '2.0.0', | ||
); | ||
|
||
$this->author = 'Cas (based upon Renegade@RenegadeProjects.com)'; | ||
$this->contact = 'Cas@nuy.info'; | ||
$this->url = 'www.nuy.info'; | ||
} | ||
|
||
/*** Default plugin configuration. */ | ||
function config() { | ||
return array( | ||
'gaugesupport_excl_status' => '80,90' , | ||
'gaugesupport_incl_severity' => '30,40', | ||
'gaugesupport_excl_resolution' => '20,40,50,60,70,90', | ||
); | ||
} | ||
|
||
function init() { | ||
plugin_event_hook('EVENT_MENU_MAIN' , 'menuLinks'); | ||
plugin_event_hook('EVENT_VIEW_BUG_EXTRA', 'renderBugSnippet'); | ||
} | ||
|
||
function menuLinks($p_event) { | ||
return array( | ||
array( | ||
'title' => plugin_lang_get( 'menu_link' ), | ||
'access_level' => '', | ||
'url' => 'plugin.php?page=GaugeSupport/issue_ranking', | ||
'icon' => 'fa-line-chart' | ||
), | ||
); | ||
} | ||
|
||
function renderBugSnippet($p_event, $bugid) { | ||
include 'plugins/GaugeSupport/pages/gauge_form.php'; | ||
} | ||
|
||
function schema() { | ||
return array( | ||
array( | ||
"CreateTableSQL", | ||
array( | ||
plugin_table( "support_data" ), | ||
" | ||
bugid I NOTNULL UNSIGNED PRIMARY, | ||
userid I NOTNULL UNSIGNED PRIMARY, | ||
rating I NOTNULL SIGNED DEFAULT 0 | ||
", | ||
array( "mysql" => "DEFAULT CHARSET=utf8" ) | ||
), | ||
) | ||
|
||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/* | ||
Gauge Support - a MantisBT plugin allowing users to express their stance on individual issues. | ||
Copyright (C) 2010 Charly Kiendl | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
// general headlines | ||
$s_plugin_GaugeSupport_menu_link = 'Issue Support Ranking'; | ||
$s_plugin_GaugeSupport_block_title = 'Issue Community Support'; | ||
$s_plugin_GaugeSupport_ranking_title = 'Community Support Ranking for {project} issues'; | ||
$s_plugin_GaugeSupport_ranking_pos_title = 'Highest-Supported {project} Issues'; | ||
$s_plugin_GaugeSupport_ranking_neg_title = 'Lowest-Supported {project} Issues'; | ||
$s_plugin_GaugeSupport_plugin_title ='Community Support Ranking for issues'; | ||
$s_plugin_GaugeSupport_excl_status ='Statusses to exclude from overview'; | ||
$s_plugin_GaugeSupport_incl_severity ='Severities to include in overview'; | ||
$s_plugin_GaugeSupport_excl_resolution ='Resolutions to exclude from overview'; | ||
|
||
// supporters / opponents | ||
$s_plugin_GaugeSupport_supporters = 'Supporters'; | ||
$s_plugin_GaugeSupport_opponents = 'Opponents'; | ||
$s_plugin_GaugeSupport_no_supporters = 'No one explicitly supports this issue yet.'; | ||
$s_plugin_GaugeSupport_no_opponents = 'No one explicitly opposes this issue yet.'; | ||
|
||
// voting | ||
$s_plugin_GaugeSupport_submit_text = 'Declare your stance!'; | ||
$s_plugin_GaugeSupport_do_it_now = 'strong support '; | ||
$s_plugin_GaugeSupport_do_it_later = 'inclined in favor '; | ||
$s_plugin_GaugeSupport_do_it_last = 'inclined against it '; | ||
$s_plugin_GaugeSupport_do_it_never = 'strong rejection '; | ||
$s_plugin_GaugeSupport_already_resolved = 'This issue is already marked as resolved.<br>If you feel that is not the case, please reopen it and explain why.'; | ||
|
||
// ranking | ||
$s_plugin_GaugeSupport_sup_sta_dis = 'Support Stance Distribution'; | ||
$s_plugin_GaugeSupport_ACS_abbr = 'ACS'; | ||
$s_plugin_GaugeSupport_ACS_elab = 'Absolute Community Support'; | ||
$s_plugin_GaugeSupport_ASPU_abbr = 'ASPU'; | ||
$s_plugin_GaugeSupport_ASPU_elab = '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'; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<?php | ||
auth_reauthenticate(); | ||
access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); | ||
layout_page_header( plugin_lang_get( 'plugin_title' ) ); | ||
layout_page_begin( 'config_page.php' ); | ||
print_manage_menu(); | ||
|
||
function print_enum_string_option_list1( $p_enum_name, $p_val) { | ||
$t_config_var_name = $p_enum_name . '_enum_string'; | ||
$t_config_var_value = config_get( $t_config_var_name ); | ||
|
||
if( is_array( $p_val ) ) { | ||
$t_val = $p_val; | ||
} else { | ||
$t_val = (int)$p_val; | ||
} | ||
|
||
$t_enum_values = MantisEnum::getValues( $t_config_var_value ); | ||
|
||
foreach ( $t_enum_values as $t_key ) { | ||
$t_elem2 = get_enum_element( $p_enum_name, $t_key ); | ||
|
||
echo '<option value="' . $t_key . '"'; | ||
check_selected1( $t_val, $t_key ); | ||
echo '>' . string_html_specialchars( $t_elem2 ) . '</option>'; | ||
} | ||
} | ||
function check_selected1( $p_var, $p_val = true, $p_strict = true ) { | ||
if( is_array( $p_var ) ) { | ||
foreach ( $p_var as $t_this_var ) { | ||
if( helper_check_variables_equal( intval($t_this_var), $p_val, $p_strict ) ) { | ||
echo ' selected="selected"'; | ||
return; | ||
} | ||
} | ||
} else { | ||
if( helper_check_variables_equal( intval($p_var), $p_val, $p_strict ) ) { | ||
echo ' selected="selected"'; | ||
} | ||
} | ||
} | ||
?> | ||
<div class="col-md-12 col-xs-12"> | ||
<div class="space-10"></div> | ||
<div class="form-container" > | ||
<br/> | ||
<form action="<?php echo plugin_page( 'config_edit' ) ?>" method="post"> | ||
<div class="widget-box widget-color-blue2"> | ||
<div class="widget-header widget-header-small"> | ||
<h4 class="widget-title lighter"> | ||
<i class="ace-icon fa fa-text-width"></i> | ||
<?php echo plugin_lang_get( 'plugin_title') . ': ' . lang_get( 'plugin_format_config' )?> | ||
</h4> | ||
</div> | ||
<div class="widget-body"> | ||
<div class="widget-main no-padding"> | ||
<div class="table-responsive"> | ||
<table class="table table-bordered table-condensed table-striped"> | ||
<tr <?php echo helper_alternate_class() ?>> | ||
<td class="category" > | ||
<?php echo plugin_lang_get( 'excl_status' ) ?> | ||
</td> | ||
<td> | ||
<?php | ||
$current= explode(",", plugin_config_get( 'gaugesupport_excl_status' )); | ||
echo '<td><select multiple ' . helper_get_tab_index() . ' id="excl_status" name="excl_status[]" class="input-sm">'; | ||
print_enum_string_option_list1( 'status', $current ); | ||
echo '</select></td>'; | ||
?> | ||
</td> | ||
</tr> | ||
<tr <?php echo helper_alternate_class() ?>> | ||
<td class="category" > | ||
<?php echo plugin_lang_get( 'incl_severity' ) ?> | ||
</td> | ||
<td> | ||
<?php | ||
$current= explode(",", plugin_config_get( 'gaugesupport_incl_severity' )); | ||
echo '<td><select multiple ' . helper_get_tab_index() . ' id="incl_severity" name="incl_severity[]" class="input-sm">'; | ||
print_enum_string_option_list1( 'severity', $current ); | ||
echo '</select></td>'; | ||
?> | ||
</td> | ||
</tr> | ||
<tr <?php echo helper_alternate_class() ?>> | ||
<td class="category" > | ||
<?php echo plugin_lang_get( 'excl_resolution' ) ?> | ||
</td> | ||
<td> | ||
<?php | ||
$current= explode(",", plugin_config_get( 'gaugesupport_excl_resolution' )); | ||
echo '<td><select multiple ' . helper_get_tab_index() . ' id="excl_resolution" name="excl_resolution[]" class="input-sm">'; | ||
print_enum_string_option_list1( 'resolution', $current ); | ||
echo '</select></td>'; | ||
?> | ||
</td> | ||
</tr> | ||
|
||
</table> | ||
</div> | ||
</div> | ||
<div class="widget-toolbox padding-8 clearfix"> | ||
<input type="submit" class="btn btn-primary btn-white btn-round" value="<?php echo lang_get( 'change_configuration' )?>" /> | ||
</div> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
<?php | ||
layout_page_end(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
auth_reauthenticate(); | ||
access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); | ||
$f_GaugeSupport_excl_status = gpc_get_string_array('excl_status'); | ||
$f_GaugeSupport_incl_severity = gpc_get_string_array('incl_severity'); | ||
$f_GaugeSupport_excl_resolution = gpc_get_string_array('excl_resolution'); | ||
plugin_config_set('gaugesupport_excl_status' , implode(",",$f_GaugeSupport_excl_status) ); | ||
plugin_config_set('gaugesupport_incl_severity' , implode(",",$f_GaugeSupport_incl_severity) ); | ||
plugin_config_set('gaugesupport_excl_resolution' , implode(",",$f_GaugeSupport_excl_resolution)); | ||
print_successful_redirect( plugin_page( 'config',TRUE ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?php | ||
# ABORT CONDITIONs | ||
if(current_user_is_anonymous()){ | ||
return; | ||
} | ||
|
||
$current= explode(",", plugin_config_get( 'gaugesupport_excl_resolution' )); | ||
if(in_array(bug_get_field($bugid, 'severity'),$current)){ | ||
return; | ||
} | ||
|
||
$current= explode(",", plugin_config_get( 'gaugesupport_excl_status' )); | ||
if(in_array(bug_get_field($bugid, 'status'),$current)){ | ||
return; | ||
} | ||
$dbtable = plugin_table("support_data"); | ||
$dbquery = "SELECT userid, rating FROM {$dbtable} WHERE bugid=$bugid"; | ||
$dboutput = db_query_bound($dbquery); | ||
|
||
$supporters = array(); | ||
$opponents = array(); | ||
|
||
// this is a bit ugly, but it was the easiest to add it to the existing code. | ||
$checked[2] = ""; | ||
$checked[1] = ""; | ||
$checked[-1] = ""; | ||
$checked[-2] = ""; | ||
|
||
if($dboutput->RecordCount() > 0) { | ||
$data = $dboutput->GetArray(); | ||
|
||
foreach($data as $row) { | ||
$row_uid = $row['userid']; | ||
$row_rating = $row['rating']; | ||
($row_rating > 0)? $type = &$supporters : $type = &$opponents; | ||
$class = (user_get_field( $row_uid, 'access_level' ) >= DEVELOPER) ? 'dev' : 'normal'; | ||
array_push($type, '<a href="./view_user_page.php?id='.$row_uid.'" class="'.$class.'">'.user_get_name($row_uid).'</a>'); | ||
|
||
if($row_uid == current_user_get_field('id')) { | ||
$checked[$row_rating] = ' checked="checked"'; | ||
} | ||
} | ||
} | ||
$supporters = implode(', ', $supporters); # abusing untyped languages 101 | ||
$opponents = implode(', ', $opponents); | ||
if(!strlen($supporters)) $supporters = plugin_lang_get('no_supporters'); | ||
if(!strlen($opponents)) $opponents = plugin_lang_get('no_opponents'); | ||
|
||
$title = plugin_lang_get('block_title'); | ||
$supportersText = plugin_lang_get('supporters'); | ||
$opponentsText = plugin_lang_get('opponents'); | ||
$submitText = plugin_lang_get('submit_text'); | ||
$highPriorityText = plugin_lang_get('do_it_now'); | ||
$normalPriorityText = plugin_lang_get('do_it_later'); | ||
$minimalPriorityText = plugin_lang_get('do_it_last'); | ||
$noPriorityText = plugin_lang_get('do_it_never'); | ||
?> | ||
<div class="col-md-12 col-xs-12"> | ||
<div class="space-10"></div> | ||
<div class="form-container" > | ||
<tr> | ||
<td class="center" colspan="6"> | ||
<?php | ||
$colspan=6; | ||
?> | ||
<tr> | ||
</div> | ||
</td> | ||
</tr> | ||
<form name="voteadding" method="post" action="<?php echo plugin_page('submit_support') ?>"> | ||
<input type="hidden" name="bugid" value="<?php echo $bugid; ?>"> | ||
<div class="widget-box widget-color-blue2"> | ||
<div class="widget-header widget-header-small"> | ||
<h4 class="widget-title lighter"> | ||
<i class="ace-icon fa fa-text-width"></i> | ||
<?php echo $title . ': ' ?> | ||
</h4> | ||
</div> | ||
<div class="widget-body"> | ||
<div class="widget-main no-padding"> | ||
<div class="table-responsive"> | ||
<table class="table table-bordered table-condensed table-striped"> | ||
|
||
<tr class="row-category"> | ||
|
||
<td colspan=6> | ||
<input type="radio" name="stance" value="2"<?php echo $checked[2];?>/> <?php echo $highPriorityText; ?> | ||
</td><td> | ||
<input type="radio" name="stance" value="1"<?php echo $checked[1];?>/><?php echo $normalPriorityText; ?> | ||
</td><td> | ||
<input type="radio" name="stance" value="-1"<?php echo$checked[-1]; ?>/> <?php echo $minimalPriorityText; ?> | ||
</td><td> | ||
<input type="radio" name="stance" value="-2"<?php echo $checked[-2]; ?>/><?php echo $noPriorityText; ?> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td colspan=4><div align="center"> | ||
<input type="submit" name="submit" value="<?php echo $submitText; ?>"> | ||
</div></td> | ||
</tr> | ||
<br> | ||
<tr> | ||
<td class="category" ><?php echo $supportersText?></td> | ||
<td colspan=3><?php echo $supporters ?></td> | ||
</tr> | ||
<tr> | ||
<td class="category"><?php echo $opponentsText ?></td> | ||
<td colspan=3><?php echo $opponents ?></td> | ||
</tr> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
</div></td> | ||
</tr> |
Oops, something went wrong.