Revision 522 (by ahitrov, 2015/10/29 16:49:37) Some system administration interface improvements
Mass section unlink for documents in browse mode

<select name="<% $name %>" class="selects"<% $style ? ' style="'.$style.'"' : '' %>>
%	select_index_tree( $root_sect, 0, $level, $check, \$color, $tree );
</select>
<%args>

	$name	=> undef
	$check	=> undef

	$root	=> 1
	$level	=> 15
	$style	=> undef

</%args>
<%init>

    my $tree;
    if ( exists $request->{"_section_tree_$root"} ) {
	$tree = $request->{"_section_tree_$root"};
    } else {
	$tree = $keeper->get_section_tree( root_id => $root );
	$request->{"_section_tree_$root"} = $tree;
    }
    my $root_sect = $tree->{root};
    my $color = 0;

    sub select_index_tree {
	my ($sect, $offset, $count_offset, $selected, $cb, $TREE) = @_;
	return	unless ref $sect;
	my $padding = 'padding-left:'.int($offset * 15).'px;';
	my $color = $$cb ? 'background:#f0f0f0;' : '';
	$$cb = $$cb ? 0 : 1;
	my $style = $sect->id == 1 ? ' style="background-color:#606060;color:#ffffff;'.$padding.$color.'"' : ' style="'.$padding.$color.'"';
	my $sel = $selected && $selected == $sect->id ? ' selected' : '';
	$m->out ('<option value="'.$sect->id.'"'.$style.$sel.'>&raquo;&nbsp;'.$sect->name.'</option>'."\n");
	if ( exists $sect->{children} && $offset < $count_offset ) {
		$offset++;
		foreach my $child ( @{$sect->{children}} ) {
			select_index_tree( $child, $offset, $count_offset, $selected, $cb, $TREE );
		}
	}
    }

</%init>