'Collapsed by default' in collapse_api + minor improvements

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
sabio
Posts: 6
Joined: 04 Apr 2005, 11:32

'Collapsed by default' in collapse_api + minor improvements

Post by sabio »

I have added suport for 'collapsed by default' feature to collapse_api. So now you can use something like:

Code: Select all

collapse_open( 'filter', true );
filter_draw_selection_area2( $p_page_number, $p_for_screen, true );
collapse_closed( 'filter' );
filter_draw_selection_area2( $p_page_number, $p_for_screen, false );
collapse_end( 'filter' );
to get corresponding region displayed collapsed by default. Note instead of hardcoding the flag you can obtain it from cookies or config.
(Have I miss something? At least I've found no way to make that filter and some other regions collapsed by default)
See new collapse_api code below.

Other improvements concern bug view page.
- You should use width="15%" for 'New relationship' column at relationship_view_box
- Consider also using collapse_api in bug_file_upload_inc.php instead of hardcoding 'ToggleDiv' feature (and please remove SetDiv call at the end of this file since it seems to be useless besides it breaks 'collapse by default' feature :)
- Both notes above concern bugnote_add_inc.php file. Plus do not forget to change second column width from 75% to 85% (otherwise 15% for the first column is not fully effective).

All these changes will make bug view page look more accurate - all the categories fields will have the same width like it's a single category column has been used thoughout the whole page. :)

These changes are made on the base of 1.0.0a2 version.
sabio
Posts: 6
Joined: 04 Apr 2005, 11:32

Changes in collapse_api

Post by sabio »

Don't want to bother with mailing lists (actually I do not plan to actively participate in Mantis development) so post my changes to collapse_api here.

The idea is quite simple:

Code: Select all

function collapse_open( $p_name, $p_collapsed_by_default = false ) {
  global ... $g_collapse_section_by_default;
...
  $g_collapse_section_by_default = $p_collapsed_by_default;

  if ( $g_collapse_section_by_default === true ) {
    echo '<div id="', $p_name , '_open" style="display: none">';
  } else {
    echo '<div id="', $p_name , '_open">';
  }
}
The same change is applied to collapse_closed:

Code: Select all

function collapse_closed( $p_name ) {
...
  if ( $g_collapse_section_by_default === true ) {
    echo '<div id="', $p_name , '_closed">';
  } else {
    echo '<div id="', $p_name , '_closed" style="display: none">';
  }
}
And that's all. :)

P.S. If there were a chance sure I'd rather prefer to attach modified collapse_api instead of posting it here. But it seems to be the most weird forum I've ever used with all it's character substitutions, atc. (e.g. why code block in preview looks different from what is displayed when reading the forum?)
sabio
Posts: 6
Joined: 04 Apr 2005, 11:32

Post by sabio »

Just noticed that unlike bug_view_advanced_page.php labels widths (<!-- Labels --> section) are not specified in bug_view_page.php
You should align those too to make these pages look alike.
thraxisp
Developer
Posts: 509
Joined: 14 Feb 2005, 03:38
Location: Ottawa, Canada
Contact:

Post by thraxisp »

Could you please file this information in the tracker at http://bugs.mantisbt.org/ ? Could you also attach the updated files and a "diff -u", if possible?
sabio
Posts: 6
Joined: 04 Apr 2005, 11:32

Post by sabio »

dingfelder
Posts: 100
Joined: 14 Aug 2005, 22:47
Location: new zealand
Contact:

status

Post by dingfelder »

did this work? and if so, what is the timeframe for getting it added to the next version?
Mr.J!M
Posts: 21
Joined: 11 Dec 2006, 17:43

Post by Mr.J!M »

i'm interested in the source file.
anybody have it?
Post Reply