1 |
8 |
ahitrov@rambler.ru |
<script type="text/javascript"> |
2 |
|
|
<!-- |
3 |
421 |
ahitrov |
function checkbox_common_toggle ( sClassSelector ) { |
4 |
|
|
$('.' + sClassSelector).each(function(){ |
5 |
|
|
var oField = $(this)[0]; |
6 |
8 |
ahitrov@rambler.ru |
if ( oField.checked ) { |
7 |
|
|
oField.checked = 0; |
8 |
|
|
} else { |
9 |
|
|
oField.checked = 1; |
10 |
|
|
} |
11 |
421 |
ahitrov |
}); |
12 |
8 |
ahitrov@rambler.ru |
} |
13 |
386 |
ahitrov |
% if ( @inline_pickups ) { |
14 |
522 |
ahitrov |
$(document).ready(function() { |
15 |
386 |
ahitrov |
% foreach my $pickup ( @inline_pickups ) { |
16 |
|
|
% my $lookup_opts = $pickup->{lookup_opts}; |
17 |
|
|
% my $search_opts = join( '&', map { $_.'='.$lookup_opts->{$_} } keys %$lookup_opts ); |
18 |
|
|
|
19 |
|
|
$('.autocomplete_<% $pickup->{attr} %>').autocomplete({ |
20 |
|
|
minLength : 2, |
21 |
|
|
source : '/contenido/ajax/document_search.html?<% $search_opts %>', |
22 |
|
|
select : function( event, ui ) |
23 |
|
|
{ |
24 |
|
|
var sStoreId = $(this).attr('rel'); |
25 |
|
|
var item = ui.item; |
26 |
|
|
// alert(mydump(item)); |
27 |
|
|
$('#' + sStoreId).val( item.id ); |
28 |
|
|
// $(this).val(item.label); |
29 |
|
|
// alert( $('#' + sStoreId).val() ); |
30 |
|
|
}, |
31 |
|
|
change : function( event, ui ) |
32 |
|
|
{ |
33 |
|
|
var sStoreId = $(this).attr('rel'); |
34 |
|
|
var sValue = $(this).val(); |
35 |
|
|
if ( sValue == '' ) { |
36 |
|
|
$('#' + sStoreId).val(''); |
37 |
|
|
} |
38 |
|
|
} |
39 |
|
|
}); |
40 |
|
|
|
41 |
|
|
% } |
42 |
|
|
}); |
43 |
|
|
% } |
44 |
|
|
|
45 |
|
|
|
46 |
|
|
function mydump(arr,level) { |
47 |
|
|
var dumped_text = ""; |
48 |
|
|
if(!level) level = 0; |
49 |
|
|
|
50 |
|
|
var level_padding = ""; |
51 |
|
|
for(var j=0;j<level+1;j++) level_padding += " "; |
52 |
|
|
|
53 |
|
|
if(typeof(arr) == 'object') { |
54 |
|
|
for(var item in arr) { |
55 |
|
|
var value = arr[item]; |
56 |
|
|
|
57 |
|
|
if(typeof(value) == 'object') { |
58 |
|
|
dumped_text += level_padding + "'" + item + "' ...\n"; |
59 |
|
|
dumped_text += mydump(value,level+1); |
60 |
|
|
} else { |
61 |
|
|
dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n"; |
62 |
|
|
} |
63 |
|
|
} |
64 |
|
|
} else { |
65 |
|
|
dumped_text = "===>"+arr+"<===("+typeof(arr)+")"; |
66 |
|
|
} |
67 |
|
|
return dumped_text; |
68 |
|
|
} |
69 |
|
|
|
70 |
|
|
|
71 |
8 |
ahitrov@rambler.ru |
//--> |
72 |
|
|
</script> |
73 |
|
|
<form name="section_browse" action="sections.html" method="POST"> |
74 |
|
|
<table width="100%" border="0" cellpadding="4" cellspacing="0" class="tlistdocs"> |
75 |
|
|
<tr bgcolor="#efefef"> |
76 |
421 |
ahitrov |
<th><a href="javascript:void(0)" onclick="checkbox_common_toggle('common-check'); return false;"><img src="/contenido/i/checkbox-14x14-green.gif" width="14" height="14" title="Выбор документов для групповых операций" align="absmiddle" border="0" style="margin-left:3px;"></a></th> |
77 |
8 |
ahitrov@rambler.ru |
% |
78 |
|
|
% foreach (@$columns) { |
79 |
421 |
ahitrov |
<th>\ |
80 |
|
|
% if ( $_->{inline} && $_->{type} eq 'checkbox' ) { |
81 |
|
|
<a href="javascript:void(0)" onclick="checkbox_common_toggle('<% $_->{attr} %>-check'); return false;"><img src="/contenido/i/checkbox-14x14-green.gif" width="14" height="14" title="Выбор документов для групповых операций" align="absmiddle" border="0" style="margin:0 5px 0 2px;"></a>\ |
82 |
|
|
% } |
83 |
|
|
<% $_->{shortname} || $_->{rusname} %></th> |
84 |
8 |
ahitrov@rambler.ru |
% } |
85 |
|
|
% |
86 |
|
|
</tr> |
87 |
|
|
% |
88 |
|
|
% unless (@$documents) { |
89 |
|
|
<tr><td align="center" colspan="<% scalar @$columns %>">Документы не найдены</td></tr> |
90 |
|
|
% } |
91 |
|
|
% foreach my $document (@$documents) { |
92 |
|
|
% |
93 |
|
|
% next unless ref($document); |
94 |
|
|
% my $document_access = $user->section_accesses($user, $document->section); |
95 |
|
|
% |
96 |
607 |
ahitrov |
<& /contenido/components/section_browse_row.msn, document => $document, columns => $columns, section => $section, |
97 |
|
|
toopi => $toopi, inline_status => $inline_status, lookup_elemets => \%lookup_elements, |
98 |
|
|
filter => $filter, params_unsection => $params_unsection, params_unclassed => $params_unclassed |
99 |
|
|
&> |
100 |
8 |
ahitrov@rambler.ru |
% } #- foreach @documents |
101 |
|
|
</table> |
102 |
|
|
<input type="hidden" name="id" value="<% $section->id %>"> |
103 |
|
|
% if ( ref $filter eq 'HASH' ) { |
104 |
|
|
% while ( my ($key, $value) = each %$filter ) { |
105 |
|
|
% next if $key eq 's'; |
106 |
|
|
<input type="hidden" name="<% $key %>" value="<% $value |h %>"> |
107 |
|
|
% } |
108 |
|
|
% } |
109 |
522 |
ahitrov |
% if ( $section->default_document_class || $section->default_table_class ) { |
110 |
|
|
<div style="display:inline-block; width:45%; margin:10px 0; min-height:80px; vertical-align:top;"> |
111 |
|
|
<& /contenido/components/inputs/parent.msn, name => 'tree', check => $section->id, style => 'width:100%;' &> |
112 |
|
|
<div style="text-align:left; margin-top:5px;"> |
113 |
|
|
<input type="submit" name="move" value="Перенести" class="input_btn"><input |
114 |
|
|
type="submit" name="link" value="Привязать" class="input_btn"><input |
115 |
|
|
type="submit" name="unlink" value="Отвязать от текущей" class="input_btn" onclick="return confirm('Объекты, не привязанные к другим секциям могут быть потеряны');"> |
116 |
|
|
</div> |
117 |
|
|
</div> |
118 |
|
|
% } |
119 |
8 |
ahitrov@rambler.ru |
% if ( $inline_status || $delete_status ) { |
120 |
522 |
ahitrov |
<div style="display:inline-block; width:45%; text-align:right; margin:5px; padding-top:29px; vertical-align:top;"> |
121 |
8 |
ahitrov@rambler.ru |
% if ( $inline_status ) { |
122 |
522 |
ahitrov |
<input type="submit" name="update" value="Сохранить изменения" class="input_btn">\ |
123 |
8 |
ahitrov@rambler.ru |
% } |
124 |
|
|
% if ( $delete_status ) { |
125 |
|
|
<input type="submit" name="delete" value="Удалить выбранные" class="input_btn" onclick="return confirm('Все отмеченные позиции будут удалены');"> |
126 |
|
|
% } |
127 |
|
|
</div> |
128 |
|
|
% } |
129 |
386 |
ahitrov |
<br clear="all"> |
130 |
8 |
ahitrov@rambler.ru |
</form> |
131 |
|
|
<%args> |
132 |
|
|
|
133 |
|
|
$section => undef |
134 |
|
|
$documents => undef |
135 |
|
|
$columns => undef |
136 |
|
|
$id => undef |
137 |
|
|
$filter => undef |
138 |
|
|
|
139 |
|
|
</%args> |
140 |
|
|
<%init> |
141 |
|
|
|
142 |
|
|
return unless ref $documents eq 'ARRAY'; |
143 |
|
|
return unless ref $columns eq 'ARRAY'; |
144 |
|
|
return unless ref $section; |
145 |
|
|
|
146 |
|
|
my $toopi = $project->documents(); |
147 |
|
|
my $inline_status = 0; |
148 |
|
|
my $delete_status = 0; |
149 |
|
|
my $params = ref $filter eq 'HASH' ? join ('&', map { $_.'='.$filter->{$_} } keys %$filter ) : ''; |
150 |
|
|
my $params_unclassed = ref $filter eq 'HASH' ? join ('&', map { $_.'='.$filter->{$_} } grep { $_ ne 'class' } keys %$filter ) : ''; |
151 |
|
|
my $params_unsection = ref $filter eq 'HASH' ? join ('&', map { $_.'='.$filter->{$_} } grep { $_ ne 's' } keys %$filter ) : ''; |
152 |
|
|
|
153 |
386 |
ahitrov |
my %lookup_elements; |
154 |
|
|
my @inline_pickups = grep { exists $_->{inline} && ($_->{type} eq 'pickup' || $_->{type} eq 'autocomplete') } @$columns; |
155 |
8 |
ahitrov@rambler.ru |
|
156 |
607 |
ahitrov |
map { |
157 |
|
|
$_->{document_access} = $user->section_accesses($user, $_->section); |
158 |
|
|
if ( $_->{document_access} == 2 ) { |
159 |
|
|
$delete_status = 1; |
160 |
|
|
} |
161 |
|
|
} @$documents; |
162 |
|
|
map { |
163 |
|
|
if ( exists $_->{inline} && $_->{inline} ) { |
164 |
|
|
$inline_status = 1; |
165 |
|
|
} |
166 |
|
|
} @$columns; |
167 |
|
|
|
168 |
8 |
ahitrov@rambler.ru |
</%init> |