Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 071e5546

Von Moritz Bunkus vor fast 10 Jahren hinzugefügt

  • ID 071e5546e649fc0108f64adfb1d0f8356dbe2716
  • Vorgänger 8a862ec0
  • Nachfolger 36b7bf7b

Pflichtenheft: durchsuchbare CVars als Spalten in Bericht anzeigen können

Unterschiede anzeigen:

SL/Controller/RequirementSpec.pm
30 30
(
31 31
  scalar                  => [ qw(requirement_spec_item visible_item visible_section) ],
32 32
  'scalar --get_set_init' => [ qw(requirement_spec customers types statuses complexities risks projects project_types project_statuses default_project_type default_project_status copy_source js
33
                                  current_text_block_output_position models time_based_units html_template cvar_configs) ],
33
                                  current_text_block_output_position models time_based_units html_template cvar_configs includeable_cvar_configs include_cvars) ],
34 34
);
35 35

  
36 36
__PACKAGE__->run_before('setup');
......
366 366
  $self->current_text_block_output_position($::form->{current_content_type} !~ m/^(?:text-blocks|tb)-(front|back)/ ? -1 : $1 eq 'front' ? 0 : 1);
367 367
}
368 368

  
369
sub init_includeable_cvar_configs {
370
  my ($self) = @_;
371
  return [ grep { $_->includeable } @{ $self->cvar_configs } ];
372
}
373

  
374
sub init_include_cvars {
375
  my ($self) = @_;
376
  return $::form->{include_cvars} if $::form->{include_cvars} && (ref($::form->{include_cvars}) eq 'HASH');
377
  return { map { ($_->name => ($_->includeable && $_->included_by_default)) } @{ $self->cvar_configs } };
378
}
379

  
369 380
#
370 381
# helpers
371 382
#
......
474 485
    );
475 486
  }
476 487

  
477
  map { $column_defs{$_}->{text} ||= $::locale->text( $self->models->get_sort_spec->{$_}->{title} ) } keys %column_defs;
488
  $column_defs{$_}->{text} ||= $::locale->text( $self->models->get_sort_spec->{$_}->{title} ) for keys %column_defs;
489

  
490
  if (!$is_template) {
491
    my %cvar_column_defs = map {
492
      my $cfg = $_;
493
      (('cvar_' . $cfg->name) => {
494
        sub     => sub { my $var = $_[0]->cvar_by_name($cfg->name); $var ? $var->value_as_text : '' },
495
        text    => $cfg->description,
496
        visible => $self->include_cvars->{ $cfg->name } ? 1 : 0,
497
      })
498
    } @{ $self->includeable_cvar_configs };
499

  
500
    push @columns, map { 'cvar_' . $_->name } @{ $self->includeable_cvar_configs };
501
    %column_defs = (%column_defs, %cvar_column_defs);
502
  }
478 503

  
479 504
  $report->set_options(
480 505
    std_column_visibility => 1,
templates/webpages/requirement_spec/_filter.html
55 55
      </tr>
56 56
     [% END %]
57 57
    [% END %]
58

  
59
    [% L.hidden_tag("include_cvars.dummy__", 1) %]
60
    [% IF SELF.includeable_cvar_configs.size %]
61
     <tr>
62
      <th align="right">[% LxERP.t8("Include in Report") %]</th>
63
      <td>
64
       <table>
65
        <tr>
66
         [% FOREACH cvar_cfg = SELF.includeable_cvar_configs %]
67
          <td>
68
           [% name__ = cvar_cfg.name;
69
              L.checkbox_tag("include_cvars." _ name__, value="1", checked=(SELF.include_cvars.$name__ ? 1 : ''), label=cvar_cfg.description) %]
70
          </td>
71
          [%- IF !loop.last && ((loop.count % 3) == 0) %]
72
           </tr><tr>
73
          [% END %]
74
         [% END %]
75
        </tr>
76
       </table>
77
      </td>
78
     </tr>
79
    [% END %]
58 80
[%- END %]
59 81
   </table>
60 82
  </p>

Auch abrufbar als: Unified diff