Skip to content

Commit

Permalink
Fixes #17411, #17412 for empty changelog/roadmap
Browse files Browse the repository at this point in the history
This change provides the user with a message that explains why the change log or roadmap pages are empty.

- Changelog message wasn't explaining what is going on.
- Changelog message wasn't showing when there were no issues, only when there were no projects.
- Changelog message formatting was using page title style.
- Roadmap had no messages.
- Roadmap had a variable to check usage that wasn't being used.

Now we show a different message based on whether the user is manager (hence can create versions)
or a regular user.

Conflicts:
	changelog_page.php
  • Loading branch information
vboctor committed Jun 30, 2014
1 parent ccd78ba commit 3a4ae91
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
20 changes: 14 additions & 6 deletions changelog_page.php
Expand Up @@ -108,6 +108,7 @@ function print_project_header_changelog ( $p_project_name ) {
echo '<tt>';
}

$t_issues_found = false;
$t_user_id = auth_get_current_user_id();

$f_project = gpc_get_string( 'project', '' );
Expand Down Expand Up @@ -173,9 +174,9 @@ function print_project_header_changelog ( $p_project_name ) {
array_unshift( $t_project_ids, $t_project_id );
}

html_page_top( lang_get( 'changelog' ) );
$t_project_id_for_access_check = $t_project_id;

$t_project_index = 0;
html_page_top( lang_get( 'changelog' ) );

version_cache_array_rows( $t_project_ids );
category_cache_array_rows_by_project( $t_project_ids );
Expand Down Expand Up @@ -335,6 +336,8 @@ function print_project_header_changelog ( $p_project_name ) {
$t_issue_set_level = $t_issue_set_levels[$j];

helper_call_custom_function( 'changelog_print_issue', array( $t_issue_set_id, $t_issue_set_level ) );

$t_issues_found = true;
}

$t_bug_string = $t_issues_resolved == 1 ? 'bug' : 'bugs';
Expand All @@ -344,11 +347,16 @@ function print_project_header_changelog ( $p_project_name ) {
if( $t_project_header_printed ) {
echo '</tt>';
}

$t_project_index++;
}

if( $t_project_index == 0 ) {
echo '<br /><span class="pagetitle">' . lang_get('changelog_empty') . '</span>';
if( !$t_issues_found ) {
if( access_has_project_level( config_get( 'manage_project_threshold' ), $t_project_id_for_access_check ) ) {
$t_string = 'changelog_empty_manager';
} else {
$t_string = 'changelog_empty';
}

echo '<p>' . lang_get( $t_string ) . '</p>';
}

html_page_bottom();
3 changes: 3 additions & 0 deletions lang/strings_english.txt
Expand Up @@ -1328,10 +1328,13 @@ $s_sponsorship_process_url = '';
# Changelog
$s_changelog = 'Change Log';
$s_changelog_empty = 'No Change Log information available';
$s_changelog_empty_manager = 'No Change Log information available. Issues are included once projects have versions and issues are resolved with "fixed in version" set.';

# Roadmap
$s_roadmap = 'Roadmap';
$s_resolved_progress = '%1$d of %2$d issue(s) resolved. Progress (%3$d%%).';
$s_roadmap_empty = 'No Roadmap information available';
$s_roadmap_empty_manager = 'No Roadmap information available. Issues are included once projects have versions and issues have "target version" set.';

# Http auth
$s_http_auth_realm = 'MantisBT Login';
Expand Down
18 changes: 15 additions & 3 deletions roadmap_page.php
Expand Up @@ -104,6 +104,8 @@ function print_project_header_roadmap( $p_project_name ) {
echo '<br /><span class="pagetitle">', string_display( $p_project_name ), ' - ', lang_get( 'roadmap' ), '</span><br />';
}

$t_issues_found = false;

$t_user_id = auth_get_current_user_id();

$f_project = gpc_get_string( 'project', '' );
Expand Down Expand Up @@ -169,9 +171,9 @@ function print_project_header_roadmap( $p_project_name ) {
array_unshift( $t_project_ids, $t_project_id );
}

html_page_top( lang_get( 'roadmap' ) );
$t_project_id_for_access_check = $t_project_id;

$t_project_index = 0;
html_page_top( lang_get( 'roadmap' ) );

version_cache_array_rows( $t_project_ids );
category_cache_array_rows_by_project( $t_project_ids );
Expand Down Expand Up @@ -350,6 +352,8 @@ function print_project_header_roadmap( $p_project_name ) {
$t_issue_set_level = $t_issue_set_levels[$j];

helper_call_custom_function( 'roadmap_print_issue', array( $t_issue_set_id, $t_issue_set_level ) );

$t_issues_found = true;
}

if( $t_issues_planned > 0 ) {
Expand All @@ -358,8 +362,16 @@ function print_project_header_roadmap( $p_project_name ) {
echo '<br /></tt>';
}
}
}

if( !$t_issues_found ) {
if( access_has_project_level( config_get( 'manage_project_threshold' ), $t_project_id_for_access_check ) ) {
$t_string = 'roadmap_empty_manager';
} else {
$t_string = 'roadmap_empty';
}

$t_project_index++;
echo '<p>' . lang_get( $t_string ) . '</p>';
}

html_page_bottom();

0 comments on commit 3a4ae91

Please sign in to comment.