Revision cd92cf1c
Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt
bin/mozilla/projects.pl | ||
---|---|---|
32 | 32 |
|
33 | 33 |
use POSIX qw(strftime); |
34 | 34 |
|
35 |
use SL::CVar; |
|
35 | 36 |
use SL::Projects; |
36 | 37 |
use SL::ReportGenerator; |
37 | 38 |
|
... | ... | |
75 | 76 |
|
76 | 77 |
$form->{title} = $locale->text('Projects'); |
77 | 78 |
|
79 |
$form->{CUSTOM_VARIABLES} = CVar->get_configs('module' => 'Projects'); |
|
80 |
($form->{CUSTOM_VARIABLES_FILTER_CODE}, |
|
81 |
$form->{CUSTOM_VARIABLES_INCLUSION_CODE}) = CVar->render_search_options('variables' => $form->{CUSTOM_VARIABLES}, |
|
82 |
'include_prefix' => 'l_', |
|
83 |
'include_value' => 'Y'); |
|
84 |
|
|
78 | 85 |
$form->header(); |
79 | 86 |
print $form->parse_html_template('projects/search'); |
80 | 87 |
|
... | ... | |
87 | 94 |
$auth->assert('project_edit'); |
88 | 95 |
|
89 | 96 |
$form->{sort} ||= 'projectnumber'; |
90 |
|
|
91 | 97 |
my $filter = $form->{filter} || { }; |
98 |
|
|
92 | 99 |
Projects->search_projects(%{ $filter }, 'sort' => $form->{sort}); |
93 | 100 |
|
94 |
my $report = SL::ReportGenerator->new(\%myconfig, $form); |
|
101 |
my $cvar_configs = CVar->get_configs('module' => 'Projects'); |
|
102 |
|
|
103 |
my $report = SL::ReportGenerator->new(\%myconfig, $form); |
|
104 |
|
|
105 |
my @columns = qw(projectnumber description active); |
|
106 |
my @hidden_vars = ('filter'); |
|
107 |
my $href = build_std_url('action=project_report', @hidden_vars); |
|
95 | 108 |
|
96 |
my @columns = qw(projectnumber description active); |
|
97 |
my @hidden_vars = ('filter'); |
|
98 |
my $href = build_std_url('action=project_report', @hidden_vars); |
|
109 |
my @includeable_custom_variables = grep { $_->{includeable} } @{ $cvar_configs }; |
|
110 |
my %column_defs_cvars = (); |
|
111 |
foreach (@includeable_custom_variables) { |
|
112 |
$column_defs_cvars{"cvar_$_->{name}"} = { |
|
113 |
'text' => $_->{description}, |
|
114 |
'visible' => $form->{"l_cvar_$_->{name}"} eq 'Y', |
|
115 |
}; |
|
116 |
} |
|
117 |
|
|
118 |
push @columns, map { "cvar_$_->{name}" } @includeable_custom_variables; |
|
99 | 119 |
|
100 |
my %column_defs = ( |
|
120 |
my %column_defs = (
|
|
101 | 121 |
'projectnumber' => { 'text' => $locale->text('Number'), }, |
102 | 122 |
'description' => { 'text' => $locale->text('Description'), }, |
103 | 123 |
'active' => { 'text' => $locale->text('Active'), 'visible' => 'both' eq $filter->{active}, }, |
124 |
%column_defs_cvars, |
|
104 | 125 |
); |
105 | 126 |
|
127 |
$main::lxdebug->dump(0, "cdc", \@columns); |
|
128 |
$main::lxdebug->dump(0, "cdc", \%column_defs); |
|
129 |
|
|
106 | 130 |
foreach (qw(projectnumber description)) { |
107 | 131 |
$column_defs{$_}->{link} = $href . "&sort=$_"; |
108 | 132 |
$column_defs{$_}->{visible} = 1; |
... | ... | |
133 | 157 |
); |
134 | 158 |
$report->set_options_from_form(); |
135 | 159 |
|
160 |
CVar->add_custom_variables_to_report('module' => 'Projects', |
|
161 |
'trans_id_field' => 'id', |
|
162 |
'configs' => $cvar_configs, |
|
163 |
'column_defs' => \%column_defs, |
|
164 |
'data' => $form->{project_list}); |
|
165 |
|
|
136 | 166 |
my $edit_url = build_std_url('action=edit&type=project'); |
137 | 167 |
my $callback = $form->escape($href) . '&sort=' . E($form->{sort}); |
138 | 168 |
|
... | ... | |
160 | 190 |
|
161 | 191 |
$form->{title} = $form->{project}->{id} ? $locale->text("Edit Project") : $locale->text("Add Project"); |
162 | 192 |
|
193 |
$form->{CUSTOM_VARIABLES} = CVar->get_custom_variables('module' => 'Projects', 'trans_id' => $form->{project}->{id}); |
|
194 |
$main::lxdebug->dump(0, "cv", $form->{CUSTOM_VARIABLES}); |
|
195 |
CVar->render_inputs('variables' => $form->{CUSTOM_VARIABLES}) if (scalar @{ $form->{CUSTOM_VARIABLES} }); |
|
196 |
|
|
163 | 197 |
$form->header(); |
164 | 198 |
print $form->parse_html_template('projects/project_form'); |
165 | 199 |
|
Auch abrufbar als: Unified diff
Benutzerdefinierte Variablen für Projekte implementiert.