• document_links_list.msn

    31 32  
    26 26 % if ( @props ) {
    27 27 % foreach my $prop ( @props ) {
    28 28 % my $field = $prop->{attr};
    29 % if ( exists $prop->{inline} ) {
    30 % $inline_status = 1;
    31 % if ( $prop->{type} =~ /^(string|integer|float)$/ ) {
    32 <td><input type="text" name="<% 'update_'.$link->id.'_'.$field %>" value="<% $link->$field |h %>" style="<% $prop->{inline_width} ? 'width:'.$prop->{inline_width}.'px;' : 'width:65px; ' %> <% $prop->{inline_style} || '' %>"></td>
    33 % } elsif ($prop->{type} eq 'checkbox') {
    34 % my $checked = $link->$field ? ' checked' : '';
    35 <td align="center"><input type="checkbox" name="<% 'update_'.$link->id.'_'.$field %>"<% $checked %>>
    36 % } elsif ($prop->{type} eq 'select') {
    37 % my $options = {};
    38 % if ($toopi && (ref($toopi) eq 'HASH') && (exists($toopi->{$link->class}))) {
    39 % %{ $options } = %{ $toopi->{$link->class} };
    40 % }
    41 % my $values = $options->{$prop->{attr}};
    42 <td><select name="<% 'update_'.$link->id.'_'.$field %>">
    43 % if ( ref $values eq 'ARRAY' ) {
    44 % foreach my $val ( @$values ) {
    45 % my $selected = $val eq $link->$field ? ' selected' : '';
    46 <option value="<% $val %>"<% $selected %>><% $val %>
    47 % }
    48 % }
    49 </select>
    50 % } elsif ($prop->{type} eq 'status') {
    51 % my $cases = $prop->{cases};
    52 % if ( ref $cases eq 'ARRAY' ) {
    53 <td><select name="<% 'update_'.$link->id.'_'.$field %>" style="<% $prop->{inline_width} ? 'width:'.$prop->{inline_width}.'px;' : '' %> <% $prop->{inline_style} || '' %>">
    54 % foreach my $case ( @$cases ) {
    55 % my $selected = $case->[0] eq $link->$field ? ' selected' : '';
    56 <option value="<% $case->[0] %>"<% $selected %>><% $case->[1] %>
    57 % }
    58 </select>
    59 % }
    60
    61 % }
    62 % } else {
    29 63 <td><% $link->$field %></td>
    64 % }
    30 65 % }
    31 66 % }
    32 <td><a href="link.html?class=<% $link->class %>&id=<% $link->id %>" target="_blank">редактировать</a></td>
    33 </tr>
    67 <td><a href="link.html?class=<% $link->class %>&id=<% $link->id %>" target="_blank">редактировать</a>
    68 % if ( $inline_status ) {
    69 <input type="hidden" name="update_<% $link->id %>_class" value="<% $link->class %>">
    70 % }
    71 </td></tr>
    34 72 % }
    35 73 </table>
    36 74 % if ( @$links ) {
     
    42 80 % } else {
    43 81 <input type="hidden" name="dest_class" value="<% $links->[0]->class %>">
    44 82 % }
    83 % if ( $inline_status ) {
    84 <input type="submit" name="update" value="Сохранить изменения" class="input_btn">
    85 % }
    45 86 <input type="submit" value="Удалить выбранные связи документа" class="input_btn"></div>
    46 87 % }
    47 88 </form>
     
    59 100 return unless ref $docs;
    60 101 return unless ref $links eq 'ARRAY' && @$links;
    61 102
    103 my $inline_status = 0;
    62 104 my $document = $destination || $source;
    63 105 my @props = $links->[0]->structure;
    64 106 @props = sort { $a->{column} <=> $b->{column} } grep { $_->{attr} ne 'class' && $_->{type} =~ /string|integer/ } grep { $_->{column} } @props;
    107 my $toopi = $project->links();
    65 108
    66 109 </%init>