Skip to content

Commit

Permalink
new version 2.2.2 of agileMantis
Browse files Browse the repository at this point in the history
  • Loading branch information
StHanek committed May 25, 2018
1 parent 49c414e commit 15f192d
Show file tree
Hide file tree
Showing 7 changed files with 173 additions and 6 deletions.
4 changes: 2 additions & 2 deletions agileMantis.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function register() {
$this->name = "agileMantis";
$this->description = "Enables Scrum on your MantisBT-Installation";
$this->page = "info";
$this->version = "2.2";
$this->version = "2.2.2";
$this->requires = array( "MantisCore" => "1.2.5" );
$this->author = "gadiv GmbH";
$this->contact = "[email protected]";
Expand Down Expand Up @@ -645,7 +645,7 @@ function getDBVersion() {
*/
function upgrade() {

plugin_config_set( 'gadiv_agilemantis_version', $this->version = "2.2" );
plugin_config_set( 'gadiv_agilemantis_version', $this->version = "2.2.2" );

$this->installConfigurationParams();

Expand Down
2 changes: 1 addition & 1 deletion core/config_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

// URL to agileMantisExpert plugin download
define( "AGILEMANTIS_EXPERT_DOWNLOAD_LINK" ,
'http://www.gadiv.de/media/content/produkte/open_source/agilemantis/agileMantisExpert.zip');
'https://www.gadiv.de/media/files/opensource/agilemantis/agileMantisExpert220.zip');

// Load agileMantis common Functions
require_once (AGILEMANTIS_PLUGIN_CLASS_URI . 'class_commonlib.php');
Expand Down
4 changes: 4 additions & 0 deletions lang/strings_english.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
$s_plugin_agileMantis_button_change = 'Change';
$s_plugin_agileMantis_button_assume = 'Adopt';
$s_plugin_agileMantis_button_resolve = 'Resolve';
$s_plugin_agileMantis_button_last = 'Last';
$s_plugin_agileMantis_button_first = 'First';
$s_plugin_agileMantis_button_prev = 'Prev';
$s_plugin_agileMantis_button_next = 'Next';

# Common Language Strings
$s_plugin_agileMantis_common_description = 'Description';
Expand Down
4 changes: 4 additions & 0 deletions lang/strings_german.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
$s_plugin_agileMantis_button_change = 'Ändern';
$s_plugin_agileMantis_button_assume = 'Übernehmen';
$s_plugin_agileMantis_button_resolve = 'Erledigen';
$s_plugin_agileMantis_button_last = 'Letzte';
$s_plugin_agileMantis_button_first = 'Erste';
$s_plugin_agileMantis_button_prev = 'Vorherige';
$s_plugin_agileMantis_button_next = 'Nächste';

# Allgemeine Sprachstrings
$s_plugin_agileMantis_common_description = 'Beschreibung';
Expand Down
119 changes: 119 additions & 0 deletions libs/class_product_backlog.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,125 @@ function getUserStoriesByProject( $project_id, $product_backlog, $status = 0 ) {
return $this->executeQuery( $t_sql, $t_params );
}

# get one page of user stories by product backlog name and page number
function getUserStoriesByProductBacklogNameAndPageNumber( $product_backlog, $page_number ) {
$t_mantis_bug_table = db_get_table( 'mantis_bug_table' );
$t_mantis_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' );
$t_mantis_project_table = db_get_table( 'mantis_project_table' );
$t_mantis_category_table = db_get_table( 'mantis_category_table' );

$this->getAdditionalProjectFields();

$t_sql = "SELECT
a.id AS id, a.project_id AS project_id, a.summary AS summary, a.status AS status,
a.target_version AS target_version, b.id AS b_category_id, b.name AS category_name,
c.id AS c_project_id, c.name AS project_name, d.value AS productBacklog
FROM $t_mantis_bug_table a
LEFT JOIN $t_mantis_category_table b ON a.category_id = b.id
LEFT JOIN $t_mantis_project_table c ON a.project_id = c.id
LEFT JOIN $t_mantis_custom_field_string_table d ON a.id = d.bug_id
WHERE d.field_id=" . db_param( 0 ) . " AND d.value=" . db_param( 1 );

$t_params = array( $this->pb, $product_backlog );

$show_resolved_userstories = $this->getConfigValue( 'show_resolved_userstories' );
$show_closed_userstories = $this->getConfigValue( 'show_closed_userstories' );
if( $show_resolved_userstories == 1 && $show_closed_userstories == 0 ) {
$t_sql .= " AND a.status <= 80";
}

if( $show_closed_userstories == 1 && $show_resolved_userstories == 0 ) {
$t_sql .= " AND a.status != 80";
}

if( $show_closed_userstories == 1 && $show_resolved_userstories == 1 ) {
$t_sql .= " AND a.status <= 90";
}

if( $show_closed_userstories == 0 && $show_resolved_userstories == 0 ) {
$t_sql .= " AND a.status < 80";
}

$show_only_project_userstories = $this->getConfigValue( 'show_only_project_userstories' );
if( $show_only_project_userstories == 1 && helper_get_current_project() > 0 ) {
$t_sql .= " AND a.project_id=" . db_param( sizeof( $t_params ) );
$t_params[] = helper_get_current_project();
}

$t_sql .= $orderby;

$bug_list = $this->executeQuery( $t_sql, $t_params );

if( !$bug_list || sizeof( $bug_list ) == 0 ) {
return array();
}

foreach( $bug_list as $row ) {
$row['businessValue'] = $this->getCustomFieldValueById( $row['id'], $this->bv );

$row['storyPoints'] = $this->getCustomFieldValueById( $row['id'], $this->sp );
if( config_get( 'show_only_us_without_storypoints', 0, auth_get_current_user_id() ) ==
1 && $row['storyPoints'] <> "" ) {
continue;
}

$row['sprint'] = $this->getCustomFieldValueById( $row['id'], $this->spr );
if( config_get( 'show_only_userstories_without_sprint', 0,
auth_get_current_user_id() ) == 1 && !empty( $row['sprint'] ) ) {
continue;
}

if( config_get( 'plugin_agileMantis_gadiv_ranking_order' ) == '1' ) {
$row['rankingOrder'] = $this->getCustomFieldValueById( $row['id'], $this->ro );
}

if( config_get( 'plugin_agileMantis_gadiv_tracker_planned_costs' ) == '1' ) {
$row['plannedWork'] = $this->getCustomFieldValueById( $row['id'], $this->pw );
}

$user_stories[] = $row;
}



$sort_by = config_get( 'current_user_product_backlog_filter', null,
auth_get_current_user_id() );
if( !empty( $_GET['sort_by'] ) && isset( $_GET['sort_by'] ) ) {
config_set( 'current_user_product_backlog_filter', $_GET['sort_by'],
auth_get_current_user_id() );
$sort_by = $_GET['sort_by'];
}

$direction = config_get( 'current_user_product_backlog_filter_direction', null,
auth_get_current_user_id() );
if( !empty( $_GET['direction'] ) && isset( $_GET['direction'] ) ) {
config_set( 'current_user_product_backlog_filter_direction', $_GET['direction'],
auth_get_current_user_id() );
$direction = $_GET['direction'];
}
$user_stories = $this->sortUserStories( $sort_by, $direction, $user_stories );


$t_filter = current_user_get_bug_filter();
$t_filter = filter_ensure_valid_filter( $t_filter );
if($t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE] > 0 && $t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE] < count($user_stories)){
$pagesize = $t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE];
} else {
$pagesize = 50;
}

$size = (int) $pagesize;
for($i = ($page_number-1)*$size; $i < (($page_number-1)*$size)+$size; $i++ ){
if(isset($user_stories[$i]) && !empty($user_stories[$i])){
$page_of_stories[] = $user_stories[$i];
}
}


return $page_of_stories;
}


# get all user stories by product backlog name
function getUserStoriesByProductBacklogName( $product_backlog ) {
$t_mantis_bug_table = db_get_table( 'mantis_bug_table' );
Expand Down
45 changes: 42 additions & 3 deletions pages/product_backlog_stories.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,41 @@
# You should have received a copy of the GNU Lesser General Public License
# along with agileMantis. If not, see <http://www.gnu.org/licenses/>.

#get all userstories for a selected product backlog
$all_stories = $agilemantis_pb->getUserStoriesByProductBacklogName( $product_backlog );

# get all user stories from a selected product backlog
$userstories = $agilemantis_pb->getUserStoriesByProductBacklogName( $product_backlog );
$t_filter = current_user_get_bug_filter();
$t_filter = filter_ensure_valid_filter( $t_filter );
if($t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE] > 0 && $t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE] < count($all_stories)){
$pagesize = $t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE];
} else {
$pagesize = 50;
}

#identify the number of pages of this product backlog
$storycount = count($all_stories);
$pagecount = ceil($storycount/(int)$pagesize);

# get the requested page of user stories from a selected product backlog or (if the requested pagenumber does not exist) get the first page
if(isset($_GET['page_number']) && !empty($_GET['page_number']) && $_GET['page_number'] <= $pagecount){
$userstories = $agilemantis_pb->getUserStoriesByProductBacklogNameAndPageNumber( $product_backlog, $_GET['page_number'] );
$page_number = $_GET['page_number'];
}else if(isset($_POST['page_number']) && !empty($_POST['page_number']) && $_POST['page_number'] <= $pagecount){
$userstories = $agilemantis_pb->getUserStoriesByProductBacklogNameAndPageNumber( $product_backlog, $_POST['page_number'] );
$page_number = $_POST['page_number'];
} else {
$userstories = $agilemantis_pb->getUserStoriesByProductBacklogNameAndPageNumber( $product_backlog, 1 );
$page_number = 1;
}
if( config_get( 'current_user_product_backlog_filter_direction',
null, auth_get_current_user_id() ) == 'ASC' ) {
$direction = 'DESC';
} else {
$direction = 'ASC';
}



# calculate amount of table columns
$columns = 4;
$columns += plugin_config_get( 'gadiv_ranking_order' );
Expand All @@ -44,6 +69,12 @@
}
?>
<br>
<div style="float: right">
<?php
print_page_links( plugin_page("product_backlog.php"), 1, $pagecount, (int)$page_number );
?>
</div>
<br>
<?php echo $system?>
<div class="table-container">
<table align="center" class="width100" cellspacing="1">
Expand Down Expand Up @@ -120,6 +151,8 @@
<input type="hidden" name="action" value="save_values">
<input type="hidden" name="productBacklogName"
value="<?php echo $product_backlog?>">
<input type="hidden" name="page_number"
value="<?php echo $page_number ?>">
<?php if(plugin_config_get('gadiv_ranking_order')=='1'){?>
<td class="category" width="60">
<a href="<?php echo plugin_page("product_backlog.php")?>
Expand Down Expand Up @@ -289,7 +322,7 @@
</td>
<td><?php echo string_display_line_links($row['summary'])?></td>
<td>
<a href="<?php echo $page_backlog?>
<a href="<?php echo plugin_page('sprint_backlog.php')?>
&sprintName=<?php echo urlencode($row['sprint'])?>">
<?php echo string_display($row['sprint']);?>
</a>
Expand Down Expand Up @@ -329,6 +362,12 @@
</table>
</div>
<br>
<div style="float: right">
<?php
print_page_links( plugin_page("product_backlog.php"), 1, $pagecount, (int)$page_number );
?>
</div>
<br>
<center>
<input type="button" name="submit"
value="<?php echo plugin_lang_get( 'button_save' )?>"
Expand Down
1 change: 1 addition & 0 deletions pages/sprint_backlog.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
}
}
# show chose sprint page or open chosen sprint directly

if( $show_all_sprints == true ) {
include(AGILEMANTIS_PLUGIN_URI.'pages/chose_sprint.php');
} else {
Expand Down

0 comments on commit 15f192d

Please sign in to comment.