Line # Revision Author
1 8 ahitrov@rambler.ru <html>
2 <head>
3 <title>Подбор документа</title>
4 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
5 </head>
6 <style>
7 <!--
8 img {border:0;}
9 form {margin:0;}
10 select {font: 9pt Verdana; margin:1pt 1pt;}
11 input {font: 9pt Verdana; margin:1pt 1pt; padding:0;}
12 textarea {font: 8pt Verdana;}
13
14 a {text-decoration:none;}
15
16 p {font: 9pt Verdana;}
17 p.td {font-size:8pt; text-align:left; margin:2pt 2mm; line-height:125%;}
18 p.std {text-align:left; margin:6pt 2mm;}
19 p.stdsm {font-size:8pt; text-align:left; margin:6pt 2mm;}
20 p.lmenu {font-size:8pt; color:gray; margin:6pt 2mm;}
21 p.rem {font-size:8pt; margin:1pt 2pt; color:#a0a0a0;}
22 p.copy {font-size:8pt; margin:6pt 2pt 2pt; color:#909090; text-align:right;}
23
24 h3 {font: 11pt Verdana; font-weight:bold; margin:6pt 4mm 4pt 2mm;}
25 h4 {font: 10pt Verdana; font-weight:bold; margin:6pt 4mm 4pt 2mm;}
26 h4.lmnu {font: 8pt Verdana; font-weight:bold; margin:4pt 2mm 2pt 4pt; padding:2pt; line-height:105%}
27
28 td {font: 8pt Verdana;}
29 td.std {padding:2pt;}
30 td.pager {padding:3px 5px;}
31 th {font: 8pt Verdana; font-weight:bold;}
32 th.sth {padding:2pt;}
33 //-->
34 </style>
35
36 <script language="Javascript">
37 <!--
38 function FillFields (ID, Name) {
39 parent.document.forms['form'].<% $vf %>.value = ID;
40 parent.document.forms['form'].<% $nf %>.value = Name;
41 parent.<% $func %>_changed();
42 parent.document.getElementById('DocFinder').style.height = 0;
43 // return false;
44 }
45 //-->
46 </script>
47
48 <body style="margin:5px; border-bottom:1px solid gray;" LINK="#0000FF" VLINK="#0000FF">
49 <table cellpadding="0" cellspacing="0" border="0" width="100%" style="border-bottom:1px solid gray;">
50 <tr valign="top"><td><h4>Подбор документа:</h4></td>
51 <td align="right">
52 <div style="text-align:right; font-weight:bold"><a href="find_document.html" style="color:red;"
53 onclick="parent.document.getElementById('DocFinder').style.height = 0;">X</a></div>
54 </td></tr>
55 </table>
56
57 % if ( $search_by ) {
58 <div style="height:3px;"><spacer type="block" height="3"></div>
59 <div style="border-bottom:1px solid gray; padding:1px;">
60 <form action="find_document.html" method="get">
61 <p class="lmenu">Ключевое слово:<br>
62 <input type="text" maxlength="255" name="search" value="<% $search %>"
63 style="border:1px solid gray; width:180px; padding:2px;">&nbsp;<input
64 type="submit" name="" value=" &raquo; "
65 style="border:1px solid gray; width:33px; padding:0; font-weight:bold;">
66 <input type="hidden" maxlength="255" name="nf" value="<% $nf %>">
67 <input type="hidden" maxlength="255" name="vf" value="<% $vf %>">
68 <input type="hidden" maxlength="255" name="show" value="<% $show %>">
69 36 ahitrov@rambler.ru % while ( my ($param, $value) = each %params ) {
70 <input type="hidden" maxlength="255" name="<% $param %>" value="<% $value %>">
71 8 ahitrov@rambler.ru % }
72 <input type="hidden" maxlength="255" name="search_by" value="<% $search_by %>">
73 </p></form></div>
74 % }
75
76 % ### Листалка
77 % ######################################
78 % if ( $total > $size ) {
79 %
80 <div style="font:9pt Atial; border-bottom:1px solid black; padding:1px; text-align:center;">
81 <& /inc/pages_.msn, p => $p, n => $size, total => $total, size => 4,
82 params => {
83 nf => $nf,
84 vf => $vf,
85 show => $show,
86 36 ahitrov@rambler.ru %params,
87 8 ahitrov@rambler.ru $search_by ? ( search_by => $search_by ) : (),
88 $search ? ( search => $search ) : (),
89 } &>
90 </div>
91 % }
92 %
93 % if ( ref $docs eq 'ARRAY' && @$docs ) {
94 % my $i = 0;
95 <table width="100%">
96 % foreach my $doc ( @$docs ) {
97 % my $name = $doc->$show;
98 % $name =~ s/'/\\'/g;
99 <tr bgcolor=<% $i++%2 ? '#f0f0f0' : 'white' %>><td class="td">&raquo;&nbsp;<a
100 href="find_document.html"
101 onclick="return FillFields(<% $doc->id %>,'<% $name |h %>')">
102 <% $doc->$show %></a></td></tr>
103 % }
104 </table>
105 % }
106 </body>
107 </html>
108 <%args>
109
110 $show => 'name'
111 $nf => undef
112 $vf => undef
113 $p => 1
114
115 </%args>
116 <%init>
117
118 return unless $nf && $vf;
119 36 ahitrov@rambler.ru my ($docs, $total);
120 8 ahitrov@rambler.ru my $size = 20;
121
122 36 ahitrov@rambler.ru my %params = %ARGS;
123 delete $params{nf};
124 delete $params{vf};
125 delete $params{show};
126 delete $params{p};
127
128 my $search_by = delete $params{search_by};
129 my $search = delete $params{search};
130
131 8 ahitrov@rambler.ru if ( $search_by && $search ) {
132 36 ahitrov@rambler.ru $params{$search_by} = '%'.$search.'%';
133 8 ahitrov@rambler.ru $params{ilike} = 1;
134 }
135
136 $docs = $keeper->get_documents (
137 %params,
138 limit => $size,
139 offset => $size*($p-1),
140 return_mode => 'array_ref',
141 );
142 $total = $keeper->get_documents (
143 %params,
144 count => 1,
145 );
146 my $func = $1 if $vf =~ /(\w+)_([A-Za-z]+)$/;
147
148 </%init>