Revision 607
- Date:
- 2016/10/28 20:56:45
- Files:
-
- /utf8/core/comps/contenido/components/cookies.msn (Diff) (Checkout)
- /utf8/core/comps/contenido/components/header.msn (Diff) (Checkout)
- /utf8/core/comps/contenido/components/section_browse.msn (Diff) (Checkout)
- /utf8/core/comps/contenido/components/section_browse_row.msn (Diff) (Checkout)
- /utf8/core/comps/contenido/components/title.msn (Diff) (Checkout)
- /utf8/core/comps/contenido/i/icons/left-right.png (Diff) (Checkout)
- /utf8/core/comps/contenido/index.html (Diff) (Checkout)
- /utf8/core/comps/contenido/sections.html (Diff) (Checkout)
- /utf8/core/lib/Contenido/Section.pm (Diff) (Checkout)
Legend:
- Added
- Removed
- Modified
-
utf8/core/comps/contenido/components/cookies.msn
13 13 -secure => 0, 14 14 ); 15 15 $cookie->bake(); 16 # $r->headers_out->add('Set-cookie' => $cookie); 17 16 } else { 18 17 my %cookies = Apache::Cookie->fetch; 19 18 my $value = $cookies{$name}->value() if exists $cookies{$name} && $cookies{$name}; -
utf8/core/comps/contenido/components/header.msn
54 54 var myW = window.open(wUri,wName,'width='+wWidth+',height='+wHeight+',top='+positionTop+',left='+positionLeft+',location=0,menubar='+menuBars+',resizable=0,scrollbars='+scrollBars+',status=0,titlebar=0,toolbar=0,directories=0,hotkeys=0') 55 55 myW.focus(); 56 56 } 57 --> 57 $(document).ready(function() { 58 $('.width-toggler').on('click', function(ev) { 59 ev.preventDefault(); 60 var $col_side = $('#column-side'); 61 var $col_content = $('#column-content'); 62 63 if ( $col_side.width() < 40 ) { 64 $col_content.width('65%'); 65 $col_side.width('35%').children('fieldset').fadeIn(300); 66 setCookie('<% $cookie_width %>', '0'); 67 } else { 68 $col_side.children('fieldset').fadeOut(300, function(){ 69 $col_side.width('0'); 70 $col_content.width('100%'); 71 }); 72 setCookie('<% $cookie_width %>', '1'); 73 } 74 }); 75 }); 76 //--> 58 77 </script> 78 <style> 79 % if ( $content_fullwidth ) { 80 #column-side { width:0; } 81 #column-side fieldset { display:none; } 82 #column-content { width:100%; } 83 % } else { 84 #column-side { width:35%; } 85 #column-content { width:65%; } 86 % } 87 </style> 88 <%once> 89 90 my $cookie_width = 'content_fullwidth'; 91 92 </%once> 59 93 <%args> 60 94 61 95 $style => undef … … 69 103 my $toopi = $project->tabs(); 70 104 71 105 my $profile = $m->comp('/contenido/components/context.msn', name => 'profile'); 106 my $content_fullwidth = $m->comp('/contenido/components/cookies.msn', name => $cookie_width); 72 107 73 108 </%init> -
utf8/core/comps/contenido/components/section_browse.msn
93 93 % next unless ref($document); 94 94 % my $document_access = $user->section_accesses($user, $document->section); 95 95 % 96 <tr valign="top"> 97 <td nowrap>\ 98 % if ($document_access == 2) { 99 % $delete_status = 1; 100 <input type="checkbox" class="common-check" name="<% 'delete_'.$document->id.'_id' %>"> 101 % } else { 102 103 % } 104 </td> 105 % 106 % for my $col (@$columns) { 107 % if ($col->{attr} eq '_sort_') { 108 % 109 <td width="20px"><% $document->{sorder} %> <a 110 href="document_move.html?id=<% $document->{id} %>&move=up&s=<% $id %><% $params_unsection ? '&'.$params_unsection : '' %>"><img 111 src="/contenido/i/ico-up-9x10.gif" border=0 alt="Переместить документ на шаг вверх"></a> <a 112 href="document_move.html?id=<% $document->{id} %>&move=down&s=<% $id %><% $params_unsection ? '&'.$params_unsection : '' %>"><img 113 src="/contenido/i/ico-down-9x10.gif" border=0 alt="Переместить документ на шаг вниз"></a>\ 114 % 115 % } elsif ($col->{attr} eq 'dtime') { 116 % 117 <td nowrap><& "/contenido/components/show_dtime.msn", dtime=>$document->{dtime} &>\ 118 % 119 % if ($document->{ctime} ne $document->{mtime}) { 120 % my $colortime = '#c66'; 121 % 122 <div style="color:<% $colortime %>;"><& "/contenido/components/show_dtime.msn", dtime=>$document->{mtime} &></div>\ 123 % 124 % } 125 % 126 % } elsif ($col->{attr} eq 'name') { 127 % 128 <td><span<% $document->contenido_status_style ? ' style="' . $document->contenido_status_style . '"' : '' %> class="<% $document->status ? '':'hiddensect' %>">\ 129 % 130 % my $name=$document->name ? $document->name : 'Безымянный документ N'.$document->id; 131 % if ($document_access == 2) { 132 % 133 <a<% $document->contenido_status_style ? ' style="' . $document->contenido_status_style . '"' : '' %> href="document.html?id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>"><% $name | h %></a>\ 134 % 135 % } else { 136 % 137 <% $name | h %>\ 138 % 139 % } 140 % 141 </span>\ 142 % 143 % } elsif ($col->{attr} eq 'id') { 144 % 145 <td><span class="<% $document->status ? '':'hiddensect' %>">\ 146 % if ($document_access == 2) { 147 <a href="document.html?id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>"><% $document->id %> </a>\ 148 % } else { 149 <% $document->id %> \ 150 % } 151 </span>\ 152 % 153 % } elsif ( exists $col->{inline} && $col->{inline} ) { 154 % $inline_status = 1; 155 % my $attr = $col->{attr}; 156 % if ( $col->{type} =~ /^(string|integer|float)$/ && $col->{inline} ) { 157 % my $style = $col->{inline_style} ? $col->{inline_style} : ($col->{type} =~ /^(integer|float)$/ ? 'text-align:right; ' : '' ); 158 % $style .= $col->{inline_width} ? ' width:'.$col->{inline_width}.'px; ' : ' width:65px; '; 159 <td><input type="text" name="<% 'update_'.$document->id.'_'.$attr %>" value="<% $document->$attr |h %>" style="<% $style %>"> 160 % } elsif ($col->{type} eq 'checkbox') { 161 % my $checked = $document->$attr ? ' checked' : ''; 162 <td align="center"><input type="checkbox" class="<% $attr %>-check" name="<% 'update_'.$document->id.'_'.$attr %>"<% $checked %>> 163 % } elsif ($col->{type} eq 'text') { 164 % my $style = $col->{inline_style} ? $col->{inline_style} : ''; 165 % $style .= $col->{inline_width} ? ' width:'.$col->{inline_width}.'px; ' : ' width:100px; '; 166 % $style .= $col->{inline_height} ? ' width:'.$col->{inline_height}.'px; ' : ' height:70px; '; 167 % my $value = $document->$attr; 168 % for ( $value ) { 169 % s/</</sgi; 170 % s/>/>/sgi; 171 % } 172 <td><textarea name="<% 'update_'.$document->id.'_'.$attr %>" style="<% $style %>"><% $value %></textarea> 173 % } elsif ($col->{type} eq 'select') { 174 % my $options = {}; 175 % if ($toopi && (ref($toopi) eq 'HASH') && (exists($toopi->{$document->class}))) { 176 % %{ $options } = %{ $toopi->{$document->class} }; 177 % } 178 % my $values = $options->{$col->{attr}}; 179 <td><select name="<% 'update_'.$document->id.'_'.$attr %>" autocomplete="off"> 180 % if ( ref $values eq 'ARRAY' ) { 181 % foreach my $val ( @$values ) { 182 % my $selected = $val eq $document->$attr ? ' selected' : ''; 183 <option value="<% $val %>"<% $selected %>><% $val %> 184 % } 185 % } 186 </select> 187 % } elsif ($col->{type} eq 'status') { 188 % my $cases = $col->{cases}; 189 % if ( ref $cases eq 'ARRAY' ) { 190 <td><select name="<% 'update_'.$document->id.'_'.$attr %>" style="<% $col->{inline_width} ? 'width:'.$col->{inline_width}.'px;' : '' %> <% $col->{inline_style} || '' %>" autocomplete="off"> 191 % foreach my $case ( @$cases ) { 192 % my $selected = $case->[0] eq $document->$attr ? ' selected' : ''; 193 <option value="<% $case->[0] %>"<% $selected %>><% $case->[1] %> 194 % } 195 </select> 196 % } 197 % } elsif ($col->{type} eq 'pickup' || $col->{type} eq 'autocomplete') { 198 % my %opts = %{ $col->{lookup_opts} }; 199 % my $doc; 200 % if ( $document->$attr ) { 201 % $doc = $keeper->get_document_by_id( $document->$attr, %opts ); 202 % } 203 <td><input type="hidden" name="<% 'update_'.$document->id.'_'.$attr %>" id="<% 'update_'.$document->id.'_'.$attr %>" value="<% ($document->$attr || '') |h %>"> 204 <input type="text" class="<% 'autocomplete_'.$attr %>" id="<% 'autocomplete_'.$document->id.'_'.$attr %>" value="<% (ref $doc ? $doc->name : '') |h %>" 205 title="<% defined $document->$attr ? 'Значение: '.$document->$attr : '' %>" 206 rel="<% 'update_'.$document->id.'_'.$attr %>" style="<% $col->{inline_width} ? 'width:'.$col->{inline_width}.'px;' : '' %> <% $col->{inline_style} || '' %>" 207 old-value="<% (ref $doc ? $doc->name : '') |h %>" onfocus="" onblur=""> 208 % } elsif ($col->{type} eq 'lookup') { 209 % my %opts = %{ $col->{lookup_opts} }; 210 % delete $opts{search_by} if exists $opts{search_by}; 211 % my $docs; 212 % if ( exists $lookup_elements{$col->{attr}} ) { 213 % $docs = $lookup_elements{$col->{attr}}; 214 % } else { 215 % $docs = $keeper->get_documents( %opts, return_mode => 'array_ref', names => 1 ); 216 % $lookup_elements{$col->{attr}} = $docs; 217 % } 218 % if ( ref $docs eq 'ARRAY' && @$docs ) { 219 <td><select name="<% 'update_'.$document->id.'_'.$attr %>" style="<% $col->{inline_width} ? 'width:'.$col->{inline_width}.'px;' : '' %> <% $col->{inline_style} || '' %>" autocomplete="off"> 220 <option value="<% $col->{allow_null} ? '' : 0 %>"></option> 221 % foreach my $case ( @$docs ) { 222 % my $selected = $case->[0] eq $document->$attr ? ' selected' : ''; 223 <option value="<% $case->[0] %>"<% $selected %>><% $case->[1] %> 224 % } 225 </select> 226 % } else { 227 <td><% $document->$attr %><input type="hidden" name="<% 'update_'.$document->id.'_'.$attr %>" value="<% $document->$attr |h %>">\ 228 % } 229 % } else { 230 <td><% $document->$attr %><input type="hidden" name="<% 'update_'.$document->id.'_'.$attr %>" value="<% $document->$attr |h %>">\ 231 % } 232 % 233 % } elsif ($col->{attr} eq 'class') { 234 % 235 <td><% $document->class_name %> <font color="#999999">(<% $document->class %>)</font>\ 236 % 237 % } elsif ($col->{type} eq 'datetime') { 238 % 239 <td nowrap><& "/contenido/components/show_dtime.msn", dtime=>$document->{$col->{attr}} &>\ 240 % 241 % } elsif ($col->{attr} eq '_act_') { 242 % 243 <td nowrap>\ 244 % if ($document_access == 2) { 245 % 246 <a href="document.html?id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>" title="Редактировать документ"><img 247 src="/contenido/i/actions/edit.gif" width="15" height="17" alt="Редактировать документ" align="absmiddle" border="0" hspace="1"></a>\ 248 <a href="document.html?clone=1&id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>" title="Копировать документ"><img 249 src="/contenido/i/actions/copy.gif" width="15" height="17" alt="Копировать документ" align="absmiddle" border="0" hspace="1"></a>\ 250 <a href="confirm.html?id=<% $document->id %>&action=documents_deletion&from=<% $section->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>" title="Удалить документ"><img 251 src="/contenido/i/actions/delete.gif" width="14" height="17" alt="Удалить документ" align="absmiddle" border="0" hspace="1"></a>\ 252 % if ( $document->status != 0 ) { 253 <a href="document.html?deactivate=1&id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>" title="Скрыть/деактивировать документ"><img 254 src="/contenido/i/actions/deactivate.gif" width="14" height="17" alt="Скрыть/деактивировать документ" align="absmiddle" border="0" hspace="1"></a>\ 255 % } 256 % if ( $document->status != 1 ) { 257 <a href="document.html?activate=1&id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>" title="Присвоить документу статус=1"><img 258 src="/contenido/i/actions/activate.gif" width="14" height="17" alt="Присвоить документу статус=1" align="absmiddle" border="0" hspace="1"></a>\ 259 % } 260 <br>\ 261 % 262 % } else { 263 \ 264 % } 265 % if ( $inline_status ) { 266 <input type="hidden" name="update_<% $document->id %>_class" value="<% $document->class %>"> 267 % } 268 % if ( $delete_status ) { 269 <input type="hidden" name="delete_<% $document->id %>_class" value="<% $document->class %>"> 270 % } 271 % 272 % } else { 273 % my $attr = $col->{attr}; 274 % if ($col->{type} eq 'date') { 275 % my $date=$document->{$col->{attr}}; 276 % $date=~/(\d{4}-\d{2}-\d{2})/; 277 <td nowrap align="right"><% $1 || ' ' %>\ 278 % } elsif ($col->{type} eq 'datetime') { 279 <td nowrap align="right"><% $document->{$col->{attr}} || ' ' %>\ 280 % } elsif ($col->{type} eq 'integer') { 281 <td align="right"><% $document->{$col->{attr}} %> \ 282 % } elsif ($col->{type} eq 'lookup' || $col->{type} eq 'pickup' || $col->{type} eq 'autocomplete') { 283 <td align="left">\ 284 % my $id = $document->{$col->{attr}}; 285 % if ($id) { 286 % my ($doc)=$keeper->get_documents( ( ref($col->{lookup_opts}) ? %{$col->{lookup_opts}} : () ), id=>$id); 287 % if ($doc) { 288 <a href="document.html?id=<% $doc->id %>&class=<% $doc->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>"><% $doc->name || $doc->id %></a> \ 289 % } else { 290 <span class="hiddensect"><% $document->{$col->{attr}} %>???</span>\ 291 % } 292 % } else { 293 <span class="hiddensect">NULL</span>\ 294 % } 295 % } elsif ($col->{type} eq 'checkbox') { 296 <td align="center"><% $document->$attr ? '<img src="/contenido/i/checked-16x16.png" width="16" height="16">' : ' ' %>\ 297 % } elsif ($col->{type} eq 'status') { 298 % my $status_map = ref $col->{cases} eq 'ARRAY' ? $col->{cases} : $keeper->default_status(); 299 % my ($doc_status) = grep { $_->[0] eq $document->{$col->{attr}} } @$status_map; 300 % $doc_status ||= [$document->{$col->{attr}}, 'Неизвестный']; 301 <td nowrap><% $doc_status->[1].'('.$doc_status->[0].')' %>\ 302 % } else { 303 <td><% defined($document->$attr) ? $document->$attr : ' ' %>\ 304 % } 305 % } 306 </td> 307 % 308 % } #- for @columns 309 % 310 </tr> 96 <& /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 &> 311 100 % } #- foreach @documents 312 101 </table> 313 102 <input type="hidden" name="id" value="<% $section->id %>"> … … 364 153 my %lookup_elements; 365 154 my @inline_pickups = grep { exists $_->{inline} && ($_->{type} eq 'pickup' || $_->{type} eq 'autocomplete') } @$columns; 366 155 156 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 367 168 </%init> -
utf8/core/comps/contenido/components/section_browse_row.msn
1 <tr valign="top"> 2 <td nowrap>\ 3 % if ($document_access == 2) { 4 <input type="checkbox" class="common-check" name="<% 'delete_'.$document->id.'_id' %>"> 5 % } else { 6 7 % } 8 </td> 9 % 10 % for my $col (@$columns) { 11 % if ($col->{attr} eq '_sort_') { 12 % 13 <td width="20px"><% $document->{sorder} %> <a 14 href="document_move.html?id=<% $document->{id} %>&move=up&s=<% $id %><% $params_unsection ? '&'.$params_unsection : '' %>"><img 15 src="/contenido/i/ico-up-9x10.gif" border=0 alt="Переместить документ на шаг вверх"></a> <a 16 href="document_move.html?id=<% $document->{id} %>&move=down&s=<% $id %><% $params_unsection ? '&'.$params_unsection : '' %>"><img 17 src="/contenido/i/ico-down-9x10.gif" border=0 alt="Переместить документ на шаг вниз"></a>\ 18 % 19 % } elsif ($col->{attr} eq 'dtime') { 20 % 21 <td nowrap><& "/contenido/components/show_dtime.msn", dtime=>$document->{dtime} &>\ 22 % 23 % if ($document->{ctime} ne $document->{mtime}) { 24 % my $colortime = '#c66'; 25 % 26 <div style="color:<% $colortime %>;"><& "/contenido/components/show_dtime.msn", dtime=>$document->{mtime} &></div>\ 27 % 28 % } 29 % 30 % } elsif ($col->{attr} eq 'name') { 31 % 32 <td><span<% $document->contenido_status_style ? ' style="' . $document->contenido_status_style . '"' : '' %> class="<% $document->status ? '':'hiddensect' %>">\ 33 % 34 % my $name=$document->name ? $document->name : 'Безымянный документ N'.$document->id; 35 % if ($document_access == 2) { 36 % 37 <a<% $document->contenido_status_style ? ' style="' . $document->contenido_status_style . '"' : '' %> href="document.html?id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>"><% $name | h %></a>\ 38 % 39 % } else { 40 % 41 <% $name | h %>\ 42 % 43 % } 44 % 45 </span>\ 46 % 47 % } elsif ($col->{attr} eq 'id') { 48 % 49 <td><span class="<% $document->status ? '':'hiddensect' %>">\ 50 % if ($document_access == 2) { 51 <a href="document.html?id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>"><% $document->id %> </a>\ 52 % } else { 53 <% $document->id %> \ 54 % } 55 </span>\ 56 % 57 % } elsif ( exists $col->{inline} && $col->{inline} ) { 58 % my $attr = $col->{attr}; 59 % if ( $col->{type} =~ /^(string|integer|float)$/ && $col->{inline} ) { 60 % my $style = $col->{inline_style} ? $col->{inline_style} : ($col->{type} =~ /^(integer|float)$/ ? 'text-align:right; ' : '' ); 61 % $style .= $col->{inline_width} ? ' width:'.$col->{inline_width}.'px; ' : ' width:65px; '; 62 <td><input type="text" name="<% 'update_'.$document->id.'_'.$attr %>" value="<% $document->$attr |h %>" style="<% $style %>"> 63 % } elsif ($col->{type} eq 'checkbox') { 64 % my $checked = $document->$attr ? ' checked' : ''; 65 <td align="center"><input type="checkbox" class="<% $attr %>-check" name="<% 'update_'.$document->id.'_'.$attr %>"<% $checked %>> 66 % } elsif ($col->{type} eq 'text') { 67 % my $style = $col->{inline_style} ? $col->{inline_style} : ''; 68 % $style .= $col->{inline_width} ? ' width:'.$col->{inline_width}.'px; ' : ' width:100px; '; 69 % $style .= $col->{inline_height} ? ' width:'.$col->{inline_height}.'px; ' : ' height:70px; '; 70 % my $value = $document->$attr; 71 % for ( $value ) { 72 % s/</</sgi; 73 % s/>/>/sgi; 74 % } 75 <td><textarea name="<% 'update_'.$document->id.'_'.$attr %>" style="<% $style %>"><% $value %></textarea> 76 % } elsif ($col->{type} eq 'select') { 77 % my $options = {}; 78 % if ($toopi && (ref($toopi) eq 'HASH') && (exists($toopi->{$document->class}))) { 79 % %{ $options } = %{ $toopi->{$document->class} }; 80 % } 81 % my $values = $options->{$col->{attr}}; 82 <td><select name="<% 'update_'.$document->id.'_'.$attr %>" autocomplete="off"> 83 % if ( ref $values eq 'ARRAY' ) { 84 % foreach my $val ( @$values ) { 85 % my $selected = $val eq $document->$attr ? ' selected' : ''; 86 <option value="<% $val %>"<% $selected %>><% $val %> 87 % } 88 % } 89 </select> 90 % } elsif ($col->{type} eq 'status') { 91 % my $cases = $col->{cases}; 92 % if ( ref $cases eq 'ARRAY' ) { 93 <td><select name="<% 'update_'.$document->id.'_'.$attr %>" style="<% $col->{inline_width} ? 'width:'.$col->{inline_width}.'px;' : '' %> <% $col->{inline_style} || '' %>" autocomplete="off"> 94 % foreach my $case ( @$cases ) { 95 % my $selected = $case->[0] eq $document->$attr ? ' selected' : ''; 96 <option value="<% $case->[0] %>"<% $selected %>><% $case->[1] %> 97 % } 98 </select> 99 % } 100 % } elsif ($col->{type} eq 'pickup' || $col->{type} eq 'autocomplete') { 101 % my %opts = %{ $col->{lookup_opts} }; 102 % my $doc; 103 % if ( $document->$attr ) { 104 % $doc = $keeper->get_document_by_id( $document->$attr, %opts ); 105 % } 106 <td><input type="hidden" name="<% 'update_'.$document->id.'_'.$attr %>" id="<% 'update_'.$document->id.'_'.$attr %>" value="<% ($document->$attr || '') |h %>"> 107 <input type="text" class="<% 'autocomplete_'.$attr %>" id="<% 'autocomplete_'.$document->id.'_'.$attr %>" value="<% (ref $doc ? $doc->name : '') |h %>" 108 title="<% defined $document->$attr ? 'Значение: '.$document->$attr : '' %>" 109 rel="<% 'update_'.$document->id.'_'.$attr %>" style="<% $col->{inline_width} ? 'width:'.$col->{inline_width}.'px;' : '' %> <% $col->{inline_style} || '' %>" 110 old-value="<% (ref $doc ? $doc->name : '') |h %>" onfocus="" onblur=""> 111 % } elsif ($col->{type} eq 'lookup') { 112 % my %opts = %{ $col->{lookup_opts} }; 113 % delete $opts{search_by} if exists $opts{search_by}; 114 % my $docs; 115 % if ( ref $lookup_elements eq 'HASH' && exists $lookup_elements->{$col->{attr}} ) { 116 % $docs = $lookup_elements->{$col->{attr}}; 117 % } else { 118 % $docs = $keeper->get_documents( %opts, return_mode => 'array_ref', names => 1 ); 119 % if ( ref $lookup_elements eq 'HASH' ) { 120 % $lookup_elements->{$col->{attr}} = $docs; 121 % } 122 % } 123 % if ( ref $docs eq 'ARRAY' && @$docs ) { 124 <td><select name="<% 'update_'.$document->id.'_'.$attr %>" style="<% $col->{inline_width} ? 'width:'.$col->{inline_width}.'px;' : '' %> <% $col->{inline_style} || '' %>" autocomplete="off"> 125 <option value="<% $col->{allow_null} ? '' : 0 %>"></option> 126 % foreach my $case ( @$docs ) { 127 % my $selected = $case->[0] eq $document->$attr ? ' selected' : ''; 128 <option value="<% $case->[0] %>"<% $selected %>><% $case->[1] %> 129 % } 130 </select> 131 % } else { 132 <td><% $document->$attr %><input type="hidden" name="<% 'update_'.$document->id.'_'.$attr %>" value="<% $document->$attr |h %>">\ 133 % } 134 % } else { 135 <td><% $document->$attr %><input type="hidden" name="<% 'update_'.$document->id.'_'.$attr %>" value="<% $document->$attr |h %>">\ 136 % } 137 % 138 % } elsif ($col->{attr} eq 'class') { 139 % 140 <td><% $document->class_name %> <font color="#999999">(<% $document->class %>)</font>\ 141 % 142 % } elsif ($col->{type} eq 'datetime') { 143 % 144 <td nowrap><& "/contenido/components/show_dtime.msn", dtime=>$document->{$col->{attr}} &>\ 145 % 146 % } elsif ($col->{attr} eq '_act_') { 147 % 148 <td nowrap>\ 149 % if ($document_access == 2) { 150 % 151 <a href="document.html?id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>" title="Редактировать документ"><img 152 src="/contenido/i/actions/edit.gif" width="15" height="17" alt="Редактировать документ" align="absmiddle" border="0" hspace="1"></a>\ 153 <a href="document.html?clone=1&id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>" title="Копировать документ"><img 154 src="/contenido/i/actions/copy.gif" width="15" height="17" alt="Копировать документ" align="absmiddle" border="0" hspace="1"></a>\ 155 <a href="confirm.html?id=<% $document->id %>&action=documents_deletion&from=<% $section->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>" title="Удалить документ"><img 156 src="/contenido/i/actions/delete.gif" width="14" height="17" alt="Удалить документ" align="absmiddle" border="0" hspace="1"></a>\ 157 % if ( $document->status != 0 ) { 158 <a href="document.html?deactivate=1&id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>" title="Скрыть/деактивировать документ"><img 159 src="/contenido/i/actions/deactivate.gif" width="14" height="17" alt="Скрыть/деактивировать документ" align="absmiddle" border="0" hspace="1"></a>\ 160 % } 161 % if ( $document->status != 1 ) { 162 <a href="document.html?activate=1&id=<% $document->id %>&class=<% $document->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>" title="Присвоить документу статус=1"><img 163 src="/contenido/i/actions/activate.gif" width="14" height="17" alt="Присвоить документу статус=1" align="absmiddle" border="0" hspace="1"></a>\ 164 % } 165 <br>\ 166 % 167 % } else { 168 \ 169 % } 170 % if ( $inline_status ) { 171 <input type="hidden" name="update_<% $document->id %>_class" value="<% $document->class %>"> 172 % } 173 % if ( $delete_status ) { 174 <input type="hidden" name="delete_<% $document->id %>_class" value="<% $document->class %>"> 175 % } 176 % 177 % } else { 178 % my $attr = $col->{attr}; 179 % if ($col->{type} eq 'date') { 180 % my $date=$document->{$col->{attr}}; 181 % $date=~/(\d{4}-\d{2}-\d{2})/; 182 <td nowrap align="right"><% $1 || ' ' %>\ 183 % } elsif ($col->{type} eq 'datetime') { 184 <td nowrap align="right"><% $document->{$col->{attr}} || ' ' %>\ 185 % } elsif ($col->{type} eq 'integer') { 186 <td align="right"><% $document->{$col->{attr}} %> \ 187 % } elsif ($col->{type} eq 'lookup' || $col->{type} eq 'pickup' || $col->{type} eq 'autocomplete') { 188 <td align="left">\ 189 % my $id = $document->{$col->{attr}}; 190 % if ($id) { 191 % my ($doc)=$keeper->get_documents( ( ref($col->{lookup_opts}) ? %{$col->{lookup_opts}} : () ), id=>$id); 192 % if ($doc) { 193 <a href="document.html?id=<% $doc->id %>&class=<% $doc->class %><% $params_unclassed ? '&'.$params_unclassed : '' %>"><% $doc->name || $doc->id %></a> \ 194 % } else { 195 <span class="hiddensect"><% $document->{$col->{attr}} %>???</span>\ 196 % } 197 % } else { 198 <span class="hiddensect">NULL</span>\ 199 % } 200 % } elsif ($col->{type} eq 'checkbox') { 201 <td align="center"><% $document->$attr ? '<img src="/contenido/i/checked-16x16.png" width="16" height="16">' : ' ' %>\ 202 % } elsif ($col->{type} eq 'status') { 203 % my $status_map = ref $col->{cases} eq 'ARRAY' ? $col->{cases} : $keeper->default_status(); 204 % my ($doc_status) = grep { $_->[0] eq $document->{$col->{attr}} } @$status_map; 205 % $doc_status ||= [$document->{$col->{attr}}, 'Неизвестный']; 206 <td nowrap><% $doc_status->[1].'('.$doc_status->[0].')' %>\ 207 % } else { 208 <td><% defined($document->$attr) ? $document->$attr : ' ' %>\ 209 % } 210 % } 211 </td> 212 % 213 % } #- for @columns 214 % 215 </tr> 216 <%args> 217 218 $toopi => undef 219 $filter => undef 220 $document => undef 221 $columns => undef 222 $section => undef 223 $inline_status => undef 224 $lookup_elements => undef 225 $params_unclassed => undef 226 $params_unsection => undef 227 228 </%args> 229 <%init> 230 231 return unless ref $document; 232 return unless ref $columns eq 'ARRAY'; 233 my $document_access = exists $document->{document_access} ? $document->{document_access} : $user->section_accesses($user, $document->section); 234 my $delete_status = $document_access == 2 ? 1 : 0; 235 my $id = ref $section ? $section->id : undef; 236 $toopi = $project->documents() unless defined $toopi; 237 238 my $params = ref $filter eq 'HASH' ? join ('&', map { $_.'='.$filter->{$_} } keys %$filter ) : ''; 239 unless ( defined $params_unclassed ) { 240 $params_unclassed = ref $filter eq 'HASH' ? join ('&', map { $_.'='.$filter->{$_} } grep { $_ ne 'class' } keys %$filter ) : ''; 241 } 242 unless ( defined $params_unsection ) { 243 $params_unsection = ref $filter eq 'HASH' ? join ('&', map { $_.'='.$filter->{$_} } grep { $_ ne 's' } keys %$filter ) : ''; 244 } 245 246 unless ( defined $inline_status ) { 247 map { 248 if ( exists $_->{inline} && $_->{inline} ) { 249 $inline_status = 1; 250 } 251 } @$columns; 252 } 253 254 </%init> -
utf8/core/comps/contenido/components/title.msn
50 50 51 51 h5, .hdr5 {font-size:11px;font-family:Tahoma;font-weight:bold;padding-top:10px;padding-bottom:5px;} 52 52 53 .rem { color:gray; font-size:85%; padding:4px } 53 .rem { color:gray; font-size:90%; padding:4px } 54 .err { color:red; font-size:90%; padding:4px } 54 55 .hiddensect { color:#909090; } 55 56 .hiddensect a { color:#909090; } 56 57 … … 141 142 142 143 }); 143 144 }); 144 <%doc> 145 function convertWord(type, content) { 146 switch (type) { 147 // Gets executed before the built in logic performes it's cleanups 148 case "before": 149 //content = content.toLowerCase(); // Some dummy logic 150 break; 145 function getCookie(name) { 146 var matches = document.cookie.match(new RegExp( 147 "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" 148 )); 149 return matches ? decodeURIComponent(matches[1]) : undefined; 150 } 151 function setCookie(name, value, options) { 152 options = options || {}; 151 153 152 // Gets executed after the built in logic performes it's cleanups 153 case "after": 154 //content = content.toLowerCase(); // Some dummy logic 155 break; 154 var expires = options.expires; 155 156 if (typeof expires == "number" && expires) { 157 var d = new Date(); 158 d.setTime(d.getTime() + expires * 1000); 159 expires = options.expires = d; 160 } 161 if (expires && expires.toUTCString) { 162 options.expires = expires.toUTCString(); 163 } 164 165 value = encodeURIComponent(value); 166 167 var updatedCookie = name + "=" + value; 168 169 for (var propName in options) { 170 updatedCookie += "; " + propName; 171 var propValue = options[propName]; 172 if (propValue !== true) { 173 updatedCookie += "=" + propValue; 156 174 } 175 } 157 176 158 return content; 177 document.cookie = updatedCookie; 159 178 } 160 </%doc> 161 179 //--> 162 180 </script> 163 181 </head> -
utf8/core/comps/contenido/index.html
3 3 4 4 <table width="100%" cellspacing="0" cellpadding="0" border="0"> 5 5 <tr valign="top"> 6 <td width="35%"> 6 <td width="35%" id="column-side"> 7 7 8 8 % my @LEFT = $m->comp('/contenido/components/tasks.msn'); 9 9 % my %LEFTh = map { $_->{attr} => $_ } (@LEFT); … … 17 17 % } 18 18 19 19 </td> 20 <td width="2%" nowrap> </td> 21 <td width="63%"> 20 <td width="2%"><a href="javascript:void()" class="width-toggler"><img src="/contenido/i/icons/left-right.png" width="30"></a></td> 21 <td width="63%" id="column-content"> 22 22 23 23 <& "/contenido/components/index_tree.msn", root => $Contenido::Section::ROOT, level => $request->{tab}{level} || 3 &> 24 24 -
utf8/core/comps/contenido/sections.html
15 15 16 16 <table width="100%" cellspacing="0" cellpadding="0" border="0"> 17 17 <tr valign="top"> 18 <td width="35%"> 18 <td id="column-side"> 19 19 20 20 <& "/contenido/components/subsection.msn", section => $owner &> 21 21 <& "/contenido/components/class_filter.msn", class=> $class, section => $owner &> … … 54 54 </fieldset> 55 55 56 56 </td> 57 <td width="2%"> </td> 58 <td width="65%"> 59 57 <td width="2%"><a href="javascript:void()" class="width-toggler"><img src="/contenido/i/icons/left-right.png" width="30"></a></td> 58 <td id="column-content"> 60 59 % if($owner->id) { 61 60 62 61 <fieldset> … … 160 159 161 160 </body> 162 161 </html> 162 <%once> 163 164 my $cookie_name = 'content_fullwidth'; 165 166 </%once> 163 167 <%args> 164 168 165 169 $id => undef … … 177 181 <%init> 178 182 179 183 $id = 0 if $id =~ /\D/; 184 my $content_fullwidth = $m->comp('/contenido/components/cookies.msn', name => $cookie_name); 185 180 186 my $owner; 181 187 182 188 # Операции... … … 481 487 if ($class && !$use_section) { 482 488 @documents = $keeper->get_documents(%filter, %order, limit=>$n, offset=>$first); 483 489 } elsif ($sorted) { 484 @documents = $keeper->get_sorted_documents(%filter, limit=>$n, offset=>$first); 490 @documents = $keeper->get_sorted_documents(%filter); 485 491 } else { 486 492 @documents = $keeper->get_documents(%filter, %order, limit=>$n, offset=>$first); 487 493 } -
utf8/core/lib/Contenido/Section.pm
64 64 class_table()->new(); 65 65 } 66 66 67 sub pre_store { 68 my $self = shift; 69 70 if ( $self->id && !$self->{__light} ) { 71 ### Autofill or autoflush documents order if applicable 72 if ( $self->_sorted && !$self->_sorted_order ) { 73 my %opts; 74 if ( $self->default_document_class ) { 75 $opts{class} = $self->default_document_class; 76 } elsif ( $self->default_table_class ) { 77 $opts{table} = $self->default_table_class; 78 } else { 79 $opts{table} = 'Contenido::SQL::DocumentTable'; 80 } 81 if ( $self->order_by ) { 82 $opts{order_by} = $self->order_by; 83 } 84 if ( $self->filters ) { 85 no strict 'vars'; 86 my $filters = eval($self->filters); 87 if ($@) { 88 warn "Bad filter: " . $self->filters . " in section " . $self->id; 89 } elsif (ref $filters eq 'HASH') { 90 while ( my ($key, $val) = each %$filters ) { 91 $opts{$key} = $val; 92 } 93 } 94 } 95 my $ids = $keeper->get_documents( s => $self->id, %opts, ids => 1, return_mode => 'array_ref' ); 96 $self->_sorted_order( join(',', @$ids) ); 97 } elsif ( !$self->_sorted && $self->_sorted_order ) { 98 $self->_sorted_order( undef ); 99 } 100 } 101 102 1; 103 } 104 67 105 #доработка метода store 68 106 sub store { 69 107 my $self=shift;