View Issue Details

IDProjectCategoryView StatusLast Update
0023694mantisbtplug-inspublic2019-04-21 02:53
ReporterRuzhelovich VladimirAssigned Todregad 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platform2.8.0OSUbuntuOS Version16.04.3 LTS
Product Version2.0.0 
Target Version2.21.0Fixed in Version2.21.0 
Summary0023694: View Issue page menu links from EVENT MENU_ISSUE event are wrapped with "[", "]" characters
Description

Wrong show the menu of plugins for EVENT MENU_ISSUE event. There are "[","]" characters in this menu.

Steps To Reproduce
//Add menu
       public function add_creat_relationship_link($p_event,$array_bug_list) {
               ob_start();
               print_link_button( $this->t_url, plugin_lang_get( 'creat_relationship' ),"btn btn-primary btn-white btn-round btn-sm$
               $link = ob_get_contents();
               ob_end_clean();
               return array($link);
    }
TagsNo tags attached.

Activities

Ruzhelovich Vladimir

Ruzhelovich Vladimir

2017-12-04 05:51

reporter  

1.png (8,108 bytes)
1.png (8,108 bytes)
Ruzhelovich Vladimir

Ruzhelovich Vladimir

2017-12-04 05:56

reporter   ~0058305

Last edited: 2019-04-12 04:55

View 2 revisions

Perhaps the problem is in this part ("bug_view_inc.php"):

foreach ( $t_links as $t_plugin => $t_hooks ) {
        foreach( $t_hooks as $t_hook ) {
                if( is_array( $t_hook ) ) {
                        foreach( $t_hook as $t_label => $t_href ) {
                                if( is_numeric( $t_label ) ) {
                                        print_bracket_link_prepared( $t_href );
                                } else {
                                        print_small_button( $t_href, $t_label );
                                }
                        }
                } elseif( !empty( $t_hook ) ) {
                        print_bracket_link_prepared( $t_hook );
                }
        }
}
Ruzhelovich Vladimir

Ruzhelovich Vladimir

2017-12-05 01:18

reporter   ~0058314

For english:



1-2.png (13,668 bytes)
1-2.png (13,668 bytes)
dregad

dregad

2019-04-12 06:18

developer   ~0061908

A PR was submitted to fix this issue - https://github.com/mantisbt/mantisbt/pull/1502

This behavior is a leftover from Mantis 1.x where links were shown as [ xxx ], this case was omitted during the ModernUI migration.

Note: the problem only occurs when the plugin's event hook returns cooked links, so IMO the proper way to fix this would be to deprecate print_bracket_link_prepared() function, update event documentation to reflect that it should return an array like [ 'label' => 'link' ] and let plugin authors adapt their code.

dregad

dregad

2019-04-12 11:17

developer   ~0061910

Last edited: 2019-04-12 11:18

View 2 revisions

Alternate PR https://github.com/mantisbt/mantisbt/pull/1503 addresses the issue by obsoleting print_bracket_link_prepared() function.

As mentioned earlier, plugins should be updated to return an associative array with the link's label as key and the link target as value, e.g.

array( plugin_lang_get( 'mypage_label' ) => plugin_page( 'mypage' );

Related Changesets

MantisBT: master 4714c1ac

2019-04-12 16:59:40

dregad

Details Diff
Obsolete print_bracket_link_prepared()

This function was used in MantisBT 1.x to display links surrounded by
square brackets for menus. With MantisBT Modern UI, it has been replaced
with CSS styling, to display the links as buttons.

One use case was not properly migrated, when displaying links on View
Issues Page (processing the EVENT_MENU_ISSUE hook).

The problem cannot be fixed properly within MantisBT code, it requires
an update of the Plugin's hook (returning an array of `label => link`
pairs instead of cooked links).

Consequently, the function has been marked as obsolete so that a warning
is displayed, to inform plugin developers that they should update their
code.

Fixes 0023694
Affected Issues
0023694
mod - core/print_api.php Diff File
mod - docbook/Developers_Guide/en-US/Events_Reference_Output.xml Diff File

Issue History

Date Modified Username Field Change
2017-12-04 05:47 Ruzhelovich Vladimir New Issue
2017-12-04 05:51 Ruzhelovich Vladimir File Added: 1.png
2017-12-04 05:56 Ruzhelovich Vladimir Note Added: 0058305
2017-12-05 01:18 Ruzhelovich Vladimir File Added: 1-2.png
2017-12-05 01:18 Ruzhelovich Vladimir Note Added: 0058314
2019-04-12 04:55 dregad Note Edited: 0058305 View Revisions
2019-04-12 06:18 dregad Status new => confirmed
2019-04-12 06:18 dregad Note Added: 0061908
2019-04-12 10:45 dregad Product Version 2.8.0 => 2.0.0
2019-04-12 10:45 dregad Summary Wrong show the menu of plugins for EVENT MENU_ISSUE event. There are "[","]" characters in this menu. => View Issue page menu links from EVENT MENU_ISSUE event are wrapped with "[", "]" characters
2019-04-12 10:45 dregad Steps to Reproduce Updated View Revisions
2019-04-12 11:17 dregad Target Version => 2.21.0
2019-04-12 11:17 dregad Note Added: 0061910
2019-04-12 11:18 dregad Note Edited: 0061910 View Revisions
2019-04-12 11:18 dregad Assigned To => dregad
2019-04-12 11:18 dregad Status confirmed => assigned
2019-04-18 08:49 dregad Changeset attached => MantisBT master 4714c1ac
2019-04-18 08:49 dregad Status assigned => resolved
2019-04-18 08:49 dregad Resolution open => fixed
2019-04-18 08:49 dregad Fixed in Version => 2.21.0
2019-04-21 02:53 vboctor Status resolved => closed