Project

General

Profile

« Previous | Next » 

Revision d47bc2ce

Added by Stephen Beaver over 9 years ago

Revise collapsible section behavior to use defines (COLLAPSIBLE, SEC_OPEN, SEC_CLOSED)

View differences:

src/usr/local/www/classes/Form/Section.class.php
26 26
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 27
	POSSIBILITY OF SUCH DAMAGE.
28 28
*/
29
define(COLLAPSIBLE, 0x08);
30
define(SEC_CLOSED, 0x04);
31
define(SEC_OPEN, 0x00);
32

  
29 33
class Form_Section extends Form_Element
30 34
{
31 35
	protected $_tagName = 'div';
......
39 43
	protected $_groups = array();
40 44
	protected $_collapsible;
41 45

  
42
	public function __construct($title, $id = "", $collapsible = false, $startcollapsed = false)
46
	public function __construct($title, $id = "", $collapsible = 0)
43 47
	{
44 48
		if (!empty($id)) {
45 49
			$this->_attributes['id'] = $id;
46 50
		}
47 51
		$this->_title = $title;
48 52
		$this->_collapsible = $collapsible;
49
		$this->_startcollapsed = $startcollapsed;
50 53
	}
51 54

  
52 55
	public function add(Form_Group $group)
......
76 79
		$hdricon = "";
77 80
		$bodyclass = '<div class="panel-body">';
78 81

  
79
		if ($this->_collapsible) {
82
		if ($this->_collapsible & COLLAPSIBLE) {
80 83
			$hdricon = '<span class="widget-heading-icon">' .
81 84
				'<a data-toggle="collapse" href="#' . $this->_attributes['id'] . ' .panel-body">' .
82 85
					'<i class="fa fa-plus-circle"></i>' .
83 86
				'</a>' .
84 87
			'</span>';
85 88
			$bodyclass = '<div class="panel-body collapse ';
86
			if ($this->_startcollapsed) {
89
			if (($this->_collapsible & SEC_CLOSED)) {
87 90
				$bodyclass .= 'out">';
88 91
			} else {
89 92
				$bodyclass .= 'in">';
src/usr/local/www/diag_logs_filter.php
207 207
if (!isset($config['syslog']['rawfilter'])) { // Advanced log filter form
208 208
	$form = new Form(false);
209 209

  
210
	$section = new Form_Section('Advanced Log Filter', 'adv-filter-panel', true, true);
210
	$section = new Form_Section('Advanced Log Filter', 'adv-filter-panel', COLLAPSIBLE|SEC_OPEN);
211 211

  
212 212
	$group = new Form_Group('');
213 213

  

Also available in: Unified diff