Revision 450

Date:
2014/11/13 14:32:01
Author:
ahitrov
Revision Log:
Section browse: the New Document list is radically shrinked when property default_table_class or default_document_class in section is set
Improved search by field in section browse. Now it shows for default_table_class filled

Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/core/comps/contenido/components/new_objects_form.msn

     
    1 1 <form action="<% $INVITE->{$proto}->[1] %>" method="GET" name="formnew">
    2 2 <div align="right">
    3 <table width="100%" border="0" cellpadding="3" cellspacing="0" class="tform">
    4 <tr><td><% $INVITE->{$proto}->[0] %></td>
    5
    6 % my $classes = [ '' => '--- Выберите тип ---' ];
    7 %
    8 % foreach my $class (sort {$a->class_name cmp $b->class_name} $proto eq 'documents' ? @{ $user->get_available_classes } : @{ $state->{'available_'.$proto} })
    9 % {
    10 % my $object = $class->new($keeper);
    11 % push @$classes, $class, "".$object->class_name()." ($class)";
    12 % }
    13
    14 <td width="100%">
    3 <table width="100%" border="0" cellpadding="3" cellspacing="0" class="tform">
    4 <tr><td><% $INVITE->{$proto}->[0] %></td>
    5 <td width="100%">
    15 6 <& "/contenido/components/select.msn", name=>'class', values=>$classes, check=>$default, style=>'width:100%;', onChange => "set_create_button(this, 'create_$btn_id')" &>
    16 </td>
    17 <td><input id="create_<% $btn_id %>" type="submit" value="Создать"<% $default ? '' : ' disabled="disabled"' %>></td>
    18 <td><input type="hidden" name="sect_id" value="<% $sect_id %>"></td>
    19 </tr></table>
    20
    7 </td>
    8 <td><input id="create_<% $btn_id %>" type="submit" value="Создать"<% $default ? '' : ' disabled="disabled"' %>></td>
    9 <td><input type="hidden" name="sect_id" value="<% $sect_id %>"></td>
    10 </tr></table>
    21 11 </div></form>
    22 12 <%ONCE>
    23 13 use locale;
    24 14 </%ONCE>
    25 15 <%ARGS>
    26 16
    27 $default => undef
    28 $proto => 'documents'
    29 $sect_id => 1
    17 $default => undef
    18 $proto => 'documents'
    19 $sect_id => 1
    20 $section => undef
    30 21
    31 22 </%ARGS>
    32 23 <%INIT>
    33 my $INVITE = {
    24
    25 my $INVITE = {
    34 26 'documents' => ['Новый&nbsp;документ','document.html'],
    35 27 'sections' => ['Новая&nbsp;секция','section.html'],
    36 28 'links' => ['Новая&nbsp;связь','link.html'],
    37 29 'users' => ['Новый&nbsp;пользователь','users.html'],
    38 30 };
    39 my $btn_id = int(rand(10000));
    31 my $btn_id = int(rand(10000));
    32
    33 my @class;
    34 if ( $proto eq 'documents' ) {
    35 @class = @{ $user->get_available_classes };
    36 if ( ref $section ) {
    37 if ( $section->default_table_class ) {
    38 @class = grep { $_->new( $keeper )->class_table eq $section->default_table_class } @class;
    39 } elsif ( $section->default_document_class ) {
    40 @class = grep { $_ eq $section->default_document_class } @class;
    41 ($default) = grep { $_ eq $section->default_document_class } @class unless $default;
    42 }
    43 }
    44 } else {
    45 @class = @{ $state->{'available_'.$proto} };
    46 }
    47
    48 my $classes = scalar @class > 1 ? [ '' => '--- Выберите тип ---' ] : [];
    49
    50 foreach my $class ( sort { $a->class_name cmp $b->class_name } @class ) {
    51 my $object = $class->new($keeper);
    52 push @$classes, $class, "".$object->class_name()." ($class)";
    53 }
    54
    40 55 </%INIT>
  • utf8/core/comps/contenido/sections.html

     
    79 79 % if ($total || scalar @documents || defined($alpha) || defined($search) ) {
    80 80 % if ($section_access == 2) {
    81 81 <& "/contenido/components/new_objects_form.msn", proto => 'documents',
    82 sect_id => $owner->id,
    82 sect_id => $owner->id, section => $owner,
    83 83 default => ($owner->default_document_class ? $owner->default_document_class : undef) &>
    84 84 % }
    85 85 <div style="font-size:12px; font-family:Arial;">
     
    91 91 % ## Форма поиска. Работает при включенном фильтре класса
    92 92 % ## и описанной для класса функции search_fields
    93 93 % ########################################################
    94 % if ( $filter{class} ) {
    95 % my $document = $filter{class}->new ($keeper);
    94 % if ( $filter{class} || $filter{table} ) {
    95 % my ($document) = $filter{class} ? ($filter{class}->new( $keeper )) : grep { $_->new( $keeper )->class_table eq $owner->default_table_class } @{ $user->get_available_classes };
    96 96 % my @fields = $document->search_fields;
    97 97 % if ( @fields ) {
    98 98 % my @props = $document->required_properties;