View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0005601 | mantisbt | bugtracker | public | 2005-05-13 18:03 | 2014-10-10 18:02 |
| Reporter | brianf | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | N/A |
| Status | new | Resolution | open | ||
| Product Version | 1.0.0a2 | ||||
| Summary | 0005601: Do not link to current page from project menu bar | ||||
| Description | Here is a simple patch so that the current project is not linked in the project menu bar. This is an important to improve navigation and usability. I have modified print_project_menu_bar to do this. I need help to modify print_menu. Is there anybody familiar enough with the code to help me to do this?? | ||||
| Tags | patch | ||||
| Attached Files | print_project_menu_bar.diff (2,623 bytes)
*** src/mantis-1.0.0a2/core/html_api.php Fri Apr 22 15:06:06 2005
--- sindar.net/bugs/core/html_api.php Fri May 13 14:54:53 2005
***************
*** 528,547 ****
# --------------------
# Print the menu bar with a list of projects to which the user has access
function print_project_menu_bar() {
$t_project_ids = current_user_get_accessible_projects();
PRINT '<table class="width100" cellspacing="0">';
PRINT '<tr>';
PRINT '<td class="menu">';
! PRINT '<a href="set_project.php?project_id=' . ALL_PROJECTS . '">' . lang_get( 'all_projects' ) . '</a>';
foreach ( $t_project_ids as $t_id ) {
! PRINT " | <a href=\"set_project.php?project_id=$t_id\">" . string_display( project_get_field( $t_id, 'name' ) ) . '</a>';
$t_subprojects = current_user_get_accessible_subprojects( $t_id );
$t_char = ':';
foreach ( $t_subprojects as $t_subproject ) {
! PRINT "$t_char <a href=\"set_project.php?project_id=$t_subproject\">" . string_display( project_get_field( $t_subproject, 'name' ) ) . '</a>';
$t_char = ',';
}
}
--- 528,561 ----
# --------------------
# Print the menu bar with a list of projects to which the user has access
+ # $t_project_id specifies the current page name so it's link can be disabled
function print_project_menu_bar() {
$t_project_ids = current_user_get_accessible_projects();
+ $t_project_id = helper_get_current_project();
PRINT '<table class="width100" cellspacing="0">';
PRINT '<tr>';
PRINT '<td class="menu">';
! if ( ALL_PROJECTS == $t_project_id ) {
! PRINT '<b>' . lang_get( 'all_projects' ) . '</b>';
! } else {
! PRINT '<a href="set_project.php?project_id=' . ALL_PROJECTS . '">' . lang_get( 'all_projects' ) . '</a>';
! }
foreach ( $t_project_ids as $t_id ) {
! if ( $t_id == $t_project_id ) {
! PRINT " | <b>" . string_display( project_get_field( $t_id, 'name' ) ) . '</b>';
! } else {
! PRINT " | <a href=\"set_project.php?project_id=$t_id\">" . string_display( project_get_field( $t_id, 'name' ) ) . '</a>';
! }
$t_subprojects = current_user_get_accessible_subprojects( $t_id );
$t_char = ':';
foreach ( $t_subprojects as $t_subproject ) {
! if ( $t_subproject == $t_project_id ) {
! PRINT "$t_char <b>" . string_display( project_get_field( $t_subproject, 'name' ) ) . '</b>';
! } else {
! PRINT "$t_char <a href=\"set_project.php?project_id=$t_subproject\">" . string_display( project_get_field( $t_subproject, 'name' ) ) . '</a>';
! }
$t_char = ',';
}
}
current_link.diff (1,534 bytes)
diff -ur src/mantis-1.0.0a2/core/string_api.php sindar.net/bugs/core/string_api.php
--- src/mantis-1.0.0a2/core/string_api.php Thu Apr 21 10:16:58 2005
+++ sindar.net/bugs/core/string_api.php Sat May 14 03:03:32 2005
@@ -519,9 +519,10 @@
# --------------------
# return an href anchor that links to a bug REPORT page for the given bug
# account for the user preference and site override
- function string_get_bug_report_link( $p_user_id = null ) {
- return '<a href="' . string_get_bug_report_url( $p_user_id ) . '">' . lang_get( 'report_bug_link' ) . '</a>';
- }
+ function string_get_bug_report_link( $p_user_id = null ) {
+ $t_current_link_class = ( isset( $_SERVER['PHP_SELF'] ) && ( strpos( $_SERVER['PHP_SELF'], "/bug_report" ) ) ) ? ' class="current"' : '';
+ return '<a href="' . string_get_bug_report_url( $p_user_id ) . '"' . $t_current_link_class . '>' . lang_get( 'report_bug_link' ) . '</a>';
+ }
# --------------------
# return the name and GET parameters of a bug REPORT page for the given bug
diff -ur src/mantis-1.0.0a2/css/default.css sindar.net/bugs/css/default.css
--- src/mantis-1.0.0a2/css/default.css Sat Jan 8 06:11:44 2005
+++ sindar.net/bugs/css/default.css Sat May 14 02:48:45 2005
@@ -9,6 +9,8 @@
a:link { color: ; }
a:visited { color: ; }
a.subtle { color: blue; text-decoration: none; }
+a.current { color: black; text-decoration: none; font-weight: bolder; }
+a.current:hover { color: blue; text-decoration: underline; }
form { display: inline; }
| ||||
|
Update: I have updated my approach. I now just add a class to each <a> in the project bar and menu bar. This allows more flexibility (only the css file needs to change to change the appearance of the current sections). I have changed default.css to make the current links bold & black, while they are blue and underlined on mouseover. The new patch supercedes the older patch. Comments? |
|