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 % if ( $class ) {
70 <input type="hidden" maxlength="255" name="class" value="<% $class %>">
71 % }
72 % if ( $s ) {
73 <input type="hidden" maxlength="255" name="s" value="<% $s %>">
74 % }
75 <input type="hidden" maxlength="255" name="search_by" value="<% $search_by %>">
76 </p></form></div>
77 % }
78
79 % ### Листалка
80 % ######################################
81 % if ( $total > $size ) {
82 %
83 <div style="font:9pt Atial; border-bottom:1px solid black; padding:1px; text-align:center;">
84 <& /inc/pages_.msn, p => $p, n => $size, total => $total, size => 4,
85 params => {
86 nf => $nf,
87 vf => $vf,
88 show => $show,
89 $class ? ( class => $class ) : (),
90 $s ? ( s => $s ) : (),
91 $search_by ? ( search_by => $search_by ) : (),
92 $search ? ( search => $search ) : (),
93 } &>
94 </div>
95 % }
96 %
97 % if ( ref $docs eq 'ARRAY' && @$docs ) {
98 % my $i = 0;
99 <table width="100%">
100 % foreach my $doc ( @$docs ) {
101 % my $name = $doc->$show;
102 % $name =~ s/'/\\'/g;
103 <tr bgcolor=<% $i++%2 ? '#f0f0f0' : 'white' %>><td class="td">&raquo;&nbsp;<a
104 href="find_document.html"
105 onclick="return FillFields(<% $doc->id %>,'<% $name |h %>')">
106 <% $doc->$show %></a></td></tr>
107 % }
108 </table>
109 % }
110 </body>
111 </html>
112 <%args>
113
114 $search_by => undef
115 $search => undef
116 $class => undef
117 $show => 'name'
118 $s => undef
119 $nf => undef
120 $vf => undef
121 $p => 1
122
123 </%args>
124 <%init>
125
126 return unless $nf && $vf;
127 my ($docs, $total, %params);
128 my $size = 20;
129
130 $params{s} = $s if $s;
131 $params{class} = $class if $class;
132 if ( $search_by && $search ) {
133 $params{$search_by} = '%'.$search.'%';
134 $params{ilike} = 1;
135 }
136
137 $docs = $keeper->get_documents (
138 %params,
139 limit => $size,
140 offset => $size*($p-1),
141 return_mode => 'array_ref',
142 );
143 $total = $keeper->get_documents (
144 %params,
145 count => 1,
146 );
147 my $func = $1 if $vf =~ /(\w+)_([A-Za-z]+)$/;
148
149 </%init>