- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
$in{item_name}=CGI::unescape($in{item_name});
$in{item_number}=CGI::unescape($in{item_number});
#убиваем пробелы сначала, с конца и двойные
###
if($in{item_name}=~/^[\s]+([\s\S]+)/) {
$in{item_name}=$1;
}
if($in{item_name}=~/([\s\S]+)[\s]+$/) {
$in{item_name}=$1;
}
$in{item_name}=~s/[\s]{2,}/ /g;
if($in{item_number}=~/^[\s]+([\s\S]+)/) {
$in{item_number}=$1;
}
if($in{item_number}=~/([\s\S]+)[\s]+$/) {
$in{item_number}=$1;
}
$in{item_number}=~s/[\s]{2,}/ /g;
####
my @select_parent=db_select_list ['title','id'],"catalog_section","parent_id=0";
###########
my $only_this_category_text;
my $checked_only;
if($in{action} eq 'filter' and !$in{only_this_cat}) { $checked_only=''; } else {$checked_only="checked"; }
#############################
my $selected_list_item;
my $only_this_cat_string;
my @selected_only;
my $selected_parent;
#die $in{only_this_cat_s};
for(@select_parent)
{my $name="index_sel_$$_{id}";
if($in{action} eq 'filter' and ($in{only_this_cat_s} eq $$_{id})) {$selected_only[$$_{id}]='selected'; } else { $selected_only[$$_{id}]=''; }
if(!$in{only_this_cat_s})
{ if(!$in{action} and ($in{s} eq $$_{id})) {$selected_only[$$_{id}]='selected'; } else { $selected_only[$$_{id}]=''; }
}else{ if($in{only_this_cat_s} eq $$_{id}){ $selected_only[$$_{id}]='selected';}}
}
############################
if($in{s}) {
#максимальная вложенность =3 - сформируем строку для чекбокса по-простому
my %ha=db_select_row ['id','title','parent_id'],"catalog_section","id=$in{s}";
if(%ha){$selected_only[$ha{parent_id}]='selected';}
my %parent=db_select_row ['title','parent_id'],"catalog_section","id=$ha{parent_id}";
my %parent2=db_select_row ['title','parent_id'],"catalog_section","id=$parent{parent_id}";
my $only_title=$ha{title};
$only_title= "$parent{title} — $only_title" if %parent;
$only_title= "$parent2{title} — $only_title" if %parent2;
$only_this_cat_string="";
if(%parent || %parent2) {#%ha
$only_this_category_text=qq~
<span>
<input type="checkbox" name="only_this_cat" id="only_this_cat" $checked_only onchange="checkSelect();">
<label for="only_this_cat">Искать только в разделе «$only_title»</label>
</span>~;
}
}
$selected_list_item=qq~<select name="only_this_cat_s" id="only_this_cat_s"> <OPTION VALUE='none'>Все разделы</OPTION>~;
for(@select_parent)
{
$selected_list_item.=qq~<OPTION VALUE='$$_{id}' $selected_only[$$_{id}]~;
$selected_list_item.=qq~><label for="only_this_cat_s">$$_{title}</label>
</OPTION>~;
}
$selected_list_item.=qq~</select></td>~;
$only_this_cat_string="Раздел каталога";