1 |
3 |
ahitrov@rambler.ru |
<script type="text/javascript"> |
2 |
|
|
<!-- |
3 |
|
|
%# ������ �������� (������������� ����� ����������) |
4 |
|
|
var statusval = new Array("<% join('", "', @ST_IDS) %>"); |
5 |
|
|
%# �������� �������� |
6 |
|
|
var statusname = new Array("<% join('", "', @ST_NAMES) %>"); |
7 |
|
|
%# �-���, ������������ ������ �������� ���������� ��������� |
8 |
|
|
function getStatus(index,n){ |
9 |
|
|
var statusvalues = n[index]; |
10 |
|
|
return statusvalues.split("|"); |
11 |
|
|
} |
12 |
|
|
%# �-���, ��������� ������ �������� |
13 |
|
|
function ch(index){ |
14 |
|
|
var CurStatVal = getStatus(index,statusval); |
15 |
|
|
var CurStatLng = CurStatVal.length; |
16 |
|
|
var CurStatName = getStatus(index,statusname); |
17 |
|
|
var StatList = document.forms["searchdoc"].elements["status"]; |
18 |
|
|
StatList.length = 0; // ������� ��� �������� �� ������ �������� |
19 |
|
|
%# ��������� ����� ������� � ������ |
20 |
|
|
for (i = 0; i < CurStatLng; i++){ |
21 |
|
|
var newStatListOption = document.createElement("OPTION"); |
22 |
|
|
newStatListOption.text = CurStatName[i]; |
23 |
|
|
newStatListOption.value = CurStatVal[i]; |
24 |
|
|
(StatList.options.add) ? StatList.options.add(newStatListOption) : StatList.add(newStatListOption, null); |
25 |
|
|
} |
26 |
|
|
} |
27 |
|
|
//--> |
28 |
|
|
</script> |
29 |
|
|
<fieldset> |
30 |
|
|
<legend>����� ����������</legend> |
31 |
|
|
<form name="searchdoc" action="search.html" method="GET" target="select"> |
32 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="6" class="tform"> |
33 |
|
|
<tr><td><b>�������� ���:</b></td></tr> |
34 |
|
|
<tr><td><& "/contenido/components/select.msn", name=>'class', values => $classes, start => '', style=>'width:100%;font-size:8pt;', onChange => 'ch(this.selectedIndex);' &></td> |
35 |
|
|
<tr><td><b>�������� ������:</b></td></tr> |
36 |
|
|
<tr><td><& "/contenido/components/select.msn", name=>'status', values => $states, start => '', style=>'width:100%;font-size:8pt;' &></td> |
37 |
|
|
<tr><td height="5"></td></tr> |
38 |
|
|
<tr><td><b>�� ����:</b></td></tr> |
39 |
|
|
<tr><td><& "/contenido/components/inputs/date.msn", name => 'from' &></td></tr> |
40 |
|
|
<tr><td><& "/contenido/components/inputs/date.msn", name => 'to' &></td></tr> |
41 |
|
|
<tr><td><input type="checkbox" name="dive" value="1">������� ����������</td></tr> |
42 |
|
|
<tr><td><input type="hidden" name="sect_id" value="<% $sect_id %>"><input type="submit" value="��������" class="btn"></td></tr> |
43 |
|
|
</table> |
44 |
|
|
</form> |
45 |
|
|
</fieldset> |
46 |
|
|
|
47 |
|
|
<%once> |
48 |
|
|
use locale; |
49 |
|
|
</%once> |
50 |
|
|
<%args> |
51 |
|
|
|
52 |
|
|
$sect_id => 1 |
53 |
|
|
$id => undef |
54 |
|
|
|
55 |
|
|
</%args> |
56 |
|
|
<%init> |
57 |
|
|
|
58 |
|
|
use vars qw($state $project $keeper $request); |
59 |
|
|
if ($id > 0) |
60 |
|
|
{ |
61 |
|
|
$sect_id = $id; |
62 |
|
|
} |
63 |
|
|
|
64 |
|
|
my ($DATA, @ST_IDS, @ST_NAMES); |
65 |
|
|
my @default_status = (); |
66 |
|
|
if (ref($keeper->default_status())) { |
67 |
|
|
@default_status = @{$keeper->default_status()}; |
68 |
|
|
} |
69 |
|
|
|
70 |
|
|
unshift @default_status, ['9999', '--- ����� ---']; |
71 |
|
|
push @$DATA, { id => '', name => '--- ����� ---', states => \@default_status }; |
72 |
|
|
|
73 |
|
|
foreach my $class (@ { $state->{available_documents} }) |
74 |
|
|
{ |
75 |
|
|
my $object = $class->new($keeper); |
76 |
|
|
my @properties = $object->structure(); |
77 |
|
|
my @states = @{$keeper->default_status()}; |
78 |
|
|
foreach my $attr (@properties) |
79 |
|
|
{ |
80 |
|
|
if ( ($attr->{attr} eq 'status') and ($attr->{type} eq 'status') ) |
81 |
|
|
{ |
82 |
|
|
@states = @{$attr->{cases}} if (exists($attr->{cases}) and (ref($attr->{cases}) eq 'ARRAY')); |
83 |
|
|
} |
84 |
|
|
} |
85 |
|
|
unshift @states, ['9999', '--- ����� ---']; |
86 |
|
|
push (@$DATA, {id => $class, name => "".$object->class_name()." ($class)", states => \@states}); |
87 |
|
|
} |
88 |
|
|
|
89 |
|
|
my $classes; |
90 |
|
|
foreach my $C (sort {$a->{name} cmp $b->{name}} @$DATA) |
91 |
|
|
{ |
92 |
|
|
push @$classes, $C->{id}, $C->{name}; |
93 |
|
|
my @st_ids; |
94 |
|
|
my @st_names; |
95 |
|
|
foreach my $st (@{$C->{states}}) |
96 |
|
|
{ |
97 |
|
|
push @st_ids, $st->[0]; |
98 |
|
|
push @st_names, $st->[1]; |
99 |
|
|
} |
100 |
|
|
push @ST_IDS, join('|', @st_ids); |
101 |
|
|
push @ST_NAMES, join('|', @st_names); |
102 |
|
|
} |
103 |
|
|
|
104 |
|
|
my $states; |
105 |
|
|
foreach my $S (sort {$a->[1] cmp $b->[1]} @default_status) |
106 |
|
|
{ |
107 |
|
|
push @$states, $S->[0], $S->[1]; |
108 |
|
|
} |
109 |
|
|
|
110 |
|
|
</%init> |