Page 1 of 1

Filter to default closed

Posted: 01 Feb 2011, 11:21
by mhonmon23
Hi,

Is there any config that will unexpanded / closed by default the filter?


Thanks

Re: Filter to default closed

Posted: 01 Feb 2011, 11:28
by istvanb
it just hides/shows the filtering options

Re: Filter to default closed

Posted: 01 Feb 2011, 11:46
by mhonmon23
No, thats not what I want. What I need is default hide the filter / search functionality

Re: Filter to default closed

Posted: 01 Feb 2011, 12:04
by mhonmon23
I found this $g_dhtml_filters = OFF; but no luck its not working.
I placed $g_dhtml_filters = OFF; under config_inc.php

Any help?


-----------------------------
after reading more.. found this
Controls the use of DHTML filters that will display the filter in view page using DHTML and javascript. Default is OFF. This requires $g_use_javascript to ne set to ON. This may not work in all browsers as it requires xmlhttprequest functionality.

Re: Filter to default closed

Posted: 01 Feb 2011, 12:08
by atrol
So you want that the filter is always hidden when opening this page?
IMO no good idea. If a user decides to open the section he wants to get it until he decides to hide the section.

Re: Filter to default closed

Posted: 01 Feb 2011, 12:10
by mhonmon23
Yes. I want it always hidden. is there possible way to keep it hidden until user decide to unhide it, but when user back to view page it should be hidden again.

Thanks

Re: Filter to default closed

Posted: 01 Feb 2011, 12:24
by atrol
AFAIK there is no customization option for this, so you would have to change the source code.
TBH I would not like to work with such a system. If I decide to open the filter I want to see the filter until I decide to hide it.

Re: Filter to default closed

Posted: 01 Feb 2011, 12:26
by mhonmon23
I see thanks atrol

Re: Filter to default closed

Posted: 01 Feb 2011, 12:37
by mhonmon23
atrol wrote:AFAIK there is no customization option for this, so you would have to change the source code.
TBH I would not like to work with such a system. If I decide to open the filter I want to see the filter until I decide to hide it.

I will tell this to my boss! hahha thanks atrol

Re: Filter to default closed

Posted: 01 Feb 2011, 12:47
by atrol
Your boss will tell you:

If you decide to open the filter you want to see the filter until you decide to hide it or your boss decides to hide it.

Re: Filter to default closed

Posted: 03 Feb 2011, 14:14
by mhonmon23
just for reference.

To make this default hide,
edit collapse_api.php

On collapse_open
if($p_name == 'profile'){ //change this string to what you want to hide as default
echo '<div id="', $t_div_id, '"', 'class="hidden"' , '>';
} else {
echo '<div id="', $t_div_id, '"', ( $t_display ? '' : ' class="hidden"' ), '>';
}

And on collapse_closed
if($p_name == 'profile'){
echo '<div id="', $t_div_id, '"', ' class' , '>';
} else {
echo '<div id="', $t_div_id, '"', ( $t_display ? '' : ' class="hidden"' ), '>';
}

Re: Filter to default closed

Posted: 08 Feb 2011, 17:06
by HiFi
atrol wrote:AFAIK there is no customization option for this, so you would have to change the source code.
TBH I would not like to work with such a system. If I decide to open the filter I want to see the filter until I decide to hide it.
Actually good point. Probably can be considered a "feature not bug" issue :)

Re: Filter to default closed

Posted: 17 Sep 2013, 07:10
by clark99
HI All,

Any good solution for this?
I still cannot make it collapse in default esp for anonymous login
using ver 1.2.15

the code provided by mhonmon23 above seems like different with the current version as below.
Highly appreciate if anybody could let me know where to edit

Code: Select all

**
 * Marks the beginning of a collapse block's open phase.
 * This will be visible if the block is expanded, or if
 * javascript is disabled.
 * @param string Collapse block name
 * @param string Collapse block section
 */
function collapse_open( $p_name, $p_section = '' ) {
	global $g_current_collapse_section, $g_open_collapse_section;

	$t_block = ( is_blank( $p_section ) ? $p_name : $p_section . '_' . $p_name );
	$t_display = collapse_display( $t_block );

	# make sure no other collapse section is started
	if( $g_current_collapse_section !== null ) {
		trigger_error( ERROR_GENERIC, ERROR );
	}

	$g_open_collapse_section = true;
	$g_current_collapse_section = $t_block;

	$t_div_id = $t_block . '_open';
	echo '<div id="', $t_div_id, '"', ( $t_display ? '' : ' class="hidden"' ), '>';
}

/**
 * Marks the end of a collapse block's open phase and the beginning
 * of the block's closed phase.  Thi will only be visible if the
 * block have been collapsed and javascript is enabled.
 * @param string Collapse block name
 * @param string Collapse block section
 */
function collapse_closed( $p_name, $p_section = '' ) {
	global $g_current_collapse_section, $g_open_collapse_section;

	$t_block = ( is_blank( $p_section ) ? $p_name : $p_section . '_' . $p_name );
	$t_display = !collapse_display( $t_block );

	# Make sure a section is opened, and it is the same section.
	if( $t_block !== $g_current_collapse_section ) {
		trigger_error( ERROR_GENERIC, ERROR );
	}

	echo '</div>';

	$g_open_collapse_section = false;

	ob_start();

	$t_div_id = $t_block . '_closed';
	echo '<div id="', $t_div_id, '"', ( $t_display ? '' : ' class="hidden"' ), '>';
}

/**
 * Marks the location where a +/- icon is placed in output
 * for the user to toggle the collapse block status.
 * This should appear in both the open and closed phase of a block.
 * @param string Collapse block name
 * @param string Collapse block section
 */
function collapse_icon( $p_name, $p_section = '' ) {
	if( OFF == config_get( 'use_javascript' ) ) {
		return;
	}

	$t_block = ( is_blank( $p_section ) ? $p_name : $p_section . '_' . $p_name );

	global $g_open_collapse_section;

	if( $g_open_collapse_section === true ) {
		$t_icon = 'minus.png';
		$t_alt = '-';
	} else {
		$t_icon = 'plus.png';
		$t_alt = '+';
	}

	echo "<a href=\"\" onclick=\"ToggleDiv( '$t_block' ); return false;\"
			><img border=\"0\" src=\"images/$t_icon\" alt=\"$t_alt\" /></a>&#160;";
}

/**
 * Marks the end of a collaps block's closed phase.
 * Closed phase output is discarded if javascript is disabled.
 * @param string Collapse block name
 * @param string Collapse block section
 */
function collapse_end( $p_name, $p_section = '' ) {
	global $g_current_collapse_section, $g_open_collapse_section;

	$t_block = ( is_blank( $p_section ) ? $p_name : $p_section . '_' . $p_name );
	$t_display = collapse_display( $t_block );

	# Make sure a section is opened, and it is the same section.
	if( $t_block !== $g_current_collapse_section ) {
		ob_end_clean();
		trigger_error( ERROR_GENERIC, ERROR );
	}

	echo '</div>';

	$g_open_collapse_section = false;

	if( ON == config_get( 'use_javascript' ) ) {
		ob_end_flush();
	} else {
		ob_end_clean();
	}

	$g_current_collapse_section = null;
}

/**
 * Determine if a block should be displayed open by default.
 * @param string Collapse block
 * @return bool
 */
function collapse_display( $p_block ) {
	global $g_collapse_cache_token;

	if( !isset( $g_collapse_cache_token[$p_block] ) || OFF == config_get( 'use_javascript' ) ) {
		return true;
	}

	return( true == $g_collapse_cache_token[$p_block] );
}


Re: Filter to default closed

Posted: 17 Sep 2013, 08:47
by clark99