Page 1 of 1

'Collapsed by default' in collapse_api + minor improvements

Posted: 06 May 2005, 08:42
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.

Changes in collapse_api

Posted: 06 May 2005, 09:01
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?)

Posted: 06 May 2005, 09:04
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.

Posted: 07 May 2005, 12:46
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?

Posted: 12 May 2005, 17:55
by sabio

status

Posted: 17 Aug 2005, 00:49
by dingfelder
did this work? and if so, what is the timeframe for getting it added to the next version?

Posted: 07 Apr 2007, 11:36
by Mr.J!M
i'm interested in the source file.
anybody have it?