Revision 713a6d70
Von Moritz Bunkus vor fast 17 Jahren hinzugefügt
SL/TODO.pm | ||
---|---|---|
1 |
# TODO list helper functions |
|
2 |
|
|
3 |
package TODO; |
|
4 |
|
|
5 |
use SL::DBUtils; |
|
6 |
|
|
7 |
sub get_user_config { |
|
8 |
$main::lxdebug->enter_sub(); |
|
9 |
|
|
10 |
my $self = shift; |
|
11 |
my %params = @_; |
|
12 |
|
|
13 |
my $myconfig = \%main::myconfig; |
|
14 |
my $form = $main::form; |
|
15 |
|
|
16 |
my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); |
|
17 |
|
|
18 |
$form->error('Need params: id or login') if (!$params{id} && !$params{login}); |
|
19 |
|
|
20 |
if ($params{login}) { |
|
21 |
($params{id}) = selectfirst_array_query($form, $dbh, qq|SELECT id FROM employee WHERE login = ?|, $params{login}); |
|
22 |
|
|
23 |
if (!$params{id}) { |
|
24 |
$main::lxdebug->leave_sub(); |
|
25 |
return (); |
|
26 |
} |
|
27 |
|
|
28 |
} else { |
|
29 |
($params{login}) = selectfirst_array_query($form, $dbh, qq|SELECT login FROM employee WHERE id = ?|, conv_i($params{id})); |
|
30 |
} |
|
31 |
|
|
32 |
my $cfg = selectfirst_hashref_query($form, $dbh, qq|SELECT * FROM todo_user_config WHERE employee_id = ?|, conv_i($params{id})); |
|
33 |
|
|
34 |
if (!$cfg) { |
|
35 |
# Standard configuration: enable all |
|
36 |
|
|
37 |
$cfg = { map { $_ => 1 } qw(show_after_login show_follow_ups show_follow_ups_login show_overdue_sales_quotations show_overdue_sales_quotations_login) }; |
|
38 |
} |
|
39 |
|
|
40 |
if (! $main::auth->check_right($params{login}, 'sales_quotation_edit')) { |
|
41 |
map { delete $cfg->{$_} } qw(show_overdue_sales_quotations show_overdue_sales_quotations_login); |
|
42 |
} |
|
43 |
|
|
44 |
$main::lxdebug->leave_sub(); |
|
45 |
|
|
46 |
return %{ $cfg }; |
|
47 |
} |
|
48 |
|
|
49 |
sub save_user_config { |
|
50 |
$main::lxdebug->enter_sub(); |
|
51 |
|
|
52 |
my $self = shift; |
|
53 |
my %params = @_; |
|
54 |
|
|
55 |
Common::check_params(\%params, qw(login)); |
|
56 |
|
|
57 |
my $myconfig = \%main::myconfig; |
|
58 |
my $form = $main::form; |
|
59 |
|
|
60 |
my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); |
|
61 |
|
|
62 |
my $query = qq|SELECT id FROM employee WHERE login = ?|; |
|
63 |
|
|
64 |
my ($id) = selectfirst_array_query($form, $dbh, $query, $params{login}); |
|
65 |
|
|
66 |
if (!$id) { |
|
67 |
$main::lxdebug->leave_sub(); |
|
68 |
return; |
|
69 |
} |
|
70 |
|
|
71 |
$query = |
|
72 |
qq|SELECT show_after_login |
|
73 |
FROM todo_user_config |
|
74 |
WHERE employee_id = ?|; |
|
75 |
|
|
76 |
if (! selectfirst_hashref_query($form, $dbh, $query, $id)) { |
|
77 |
do_query($form, $dbh, qq|INSERT INTO todo_user_config (employee_id) VALUES (?)|, $id); |
|
78 |
} |
|
79 |
|
|
80 |
$query = |
|
81 |
qq|UPDATE todo_user_config SET |
|
82 |
show_after_login = ?, |
|
83 |
show_follow_ups = ?, |
|
84 |
show_follow_ups_login = ?, |
|
85 |
show_overdue_sales_quotations = ?, |
|
86 |
show_overdue_sales_quotations_login = ? |
|
87 |
|
|
88 |
WHERE employee_id = ?|; |
|
89 |
|
|
90 |
my @values = map { $params{$_} ? 't' : 'f' } qw(show_after_login show_follow_ups show_follow_ups_login show_overdue_sales_quotations show_overdue_sales_quotations_login); |
|
91 |
push @values, $id; |
|
92 |
|
|
93 |
do_query($form, $dbh, $query, @values); |
|
94 |
|
|
95 |
$dbh->commit(); |
|
96 |
|
|
97 |
$main::lxdebug->leave_sub(); |
|
98 |
} |
|
99 |
|
|
100 |
1; |
bin/mozilla/am.pl | ||
---|---|---|
38 | 38 |
use SL::User; |
39 | 39 |
use SL::USTVA; |
40 | 40 |
use SL::Iconv; |
41 |
use SL::TODO; |
|
41 | 42 |
use CGI::Ajax; |
42 | 43 |
use CGI; |
43 | 44 |
|
... | ... | |
2491 | 2492 |
$myconfig{show_form_details} = 1 unless (defined($myconfig{show_form_details})); |
2492 | 2493 |
$form->{"menustyle_$myconfig{menustyle}"} = 1; |
2493 | 2494 |
$form->{CAN_CHANGE_PASSWORD} = $auth->can_change_password(); |
2495 |
$form->{todo_cfg} = { TODO->get_user_config('login' => $form->{login}) }; |
|
2494 | 2496 |
|
2495 | 2497 |
$form->{title} = $locale->text('Edit Preferences for #1', $form->{login}); |
2496 | 2498 |
|
... | ... | |
2505 | 2507 |
|
2506 | 2508 |
$form->{stylesheet} = $form->{usestylesheet}; |
2507 | 2509 |
|
2510 |
TODO->save_user_config('login' => $form->{login}, %{ $form->{todo_cfg} || { } }); |
|
2511 |
|
|
2508 | 2512 |
$form->redirect($locale->text('Preferences saved!')) if (AM->save_preferences(\%myconfig, \%$form, $webdav)); |
2509 | 2513 |
$form->error($locale->text('Cannot save preferences!')); |
2510 | 2514 |
|
bin/mozilla/login.pl | ||
---|---|---|
164 | 164 |
|
165 | 165 |
$locale = new Locale $myconfig{countrycode}, "login" if ($language ne $myconfig{countrycode}); |
166 | 166 |
|
167 |
$form->{todo_list} = create_todo_list();
|
|
167 |
$form->{todo_list} = create_todo_list('login_screen' => 1) if (!$form->{no_todo_list});
|
|
168 | 168 |
|
169 | 169 |
$form->{stylesheet} = $myconfig{stylesheet}; |
170 | 170 |
$form->{title} = $locale->text('About'); |
bin/mozilla/todo.pl | ||
---|---|---|
27 | 27 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
28 | 28 |
####################################################################### |
29 | 29 |
|
30 |
use SL::TODO; |
|
31 |
|
|
30 | 32 |
sub create_todo_list { |
31 | 33 |
$lxdebug->enter_sub(); |
32 | 34 |
|
35 |
my %params = @_; |
|
36 |
my $postfix = '_login' if ($params{login_screen}); |
|
37 |
|
|
38 |
my %todo_cfg = TODO->get_user_config('login' => $form->{login}); |
|
39 |
|
|
40 |
if ($params{login_screen} && !$todo_cfg{show_after_login}) { |
|
41 |
$lxdebug->leave_sub(); |
|
42 |
return ''; |
|
43 |
} |
|
44 |
|
|
33 | 45 |
my (@todo_items, $todo_list); |
34 | 46 |
|
35 |
push @todo_items, todo_list_follow_ups(); |
|
36 |
push @todo_items, todo_list_overdue_sales_quotations(); |
|
47 |
push @todo_items, todo_list_follow_ups() if ($todo_cfg{"show_follow_ups${postfix}"});
|
|
48 |
push @todo_items, todo_list_overdue_sales_quotations() if ($todo_cfg{"show_overdue_sales_quotations${postfix}"});
|
|
37 | 49 |
|
38 | 50 |
@todo_items = grep { $_ } @todo_items; |
39 | 51 |
$todo_list = join("", @todo_items); |
locale/de/all | ||
---|---|---|
20 | 20 |
'<%total%> -- Amount payable' => '<%total%> -- Noch zu bezahlender Betrag', |
21 | 21 |
'<%total_wo_skonto%> -- Amount payable less discount' => '<%total_wo_skonto%> -- Noch zu bezahlender Betrag abzüglich Skonto', |
22 | 22 |
'*/' => '*/', |
23 |
'...after loggin in' => '...nach dem Anmelden', |
|
23 | 24 |
'...done' => '...fertig', |
25 |
'...on the TODO list' => '...auf der Aufgabenliste', |
|
24 | 26 |
'1. Quarter' => '1. Quartal', |
25 | 27 |
'2. Quarter' => '2. Quartal', |
26 | 28 |
'3. Quarter' => '3. Quartal', |
... | ... | |
291 | 293 |
'Company' => 'Firma', |
292 | 294 |
'Company Name' => 'Firmenname', |
293 | 295 |
'Compare to' => 'Gegen?berstellen zu', |
296 |
'Configuration of individual TODO items' => 'Konfiguration für die einzelnen Aufgabenlistenpunkte', |
|
294 | 297 |
'Confirm!' => 'Best?tigen Sie!', |
295 | 298 |
'Confirmation' => 'Auftragsbest?tigung', |
296 | 299 |
'Contact' => 'Kontakt', |
... | ... | |
1165 | 1168 |
'Show TODO list' => 'Aufgabenliste anzeigen', |
1166 | 1169 |
'Show by default' => 'Standardmäßig anzeigen', |
1167 | 1170 |
'Show details' => 'Details anzeigen', |
1171 |
'Show follow ups...' => 'Zeige Wiedervorlagen...', |
|
1168 | 1172 |
'Show old dunnings' => 'Alte Mahnungen anzeigen', |
1173 |
'Show overdue sales quotations...' => 'Zeige überfällige Angebote...', |
|
1174 |
'Show your TODO list after loggin in' => 'Aufgabenliste nach dem Anmelden anzeigen', |
|
1169 | 1175 |
'Signature' => 'Unterschrift', |
1170 | 1176 |
'Skip' => '?berspringen', |
1171 | 1177 |
'Skonto' => 'Skonto', |
... | ... | |
1197 | 1203 |
'Superuser name' => 'Datenbankadministrator', |
1198 | 1204 |
'System' => 'System', |
1199 | 1205 |
'TODO list' => 'Aufgabenliste', |
1206 |
'TODO list options' => 'Aufgabenlistenoptionen', |
|
1200 | 1207 |
'TOP100' => 'Top 100', |
1201 | 1208 |
'Tax' => 'Steuer', |
1202 | 1209 |
'Tax Consultant' => 'Steuerberater/-in', |
menu.ini | ||
---|---|---|
729 | 729 |
[Programm--Version] |
730 | 730 |
module=login.pl |
731 | 731 |
action=company_logo |
732 |
no_todo_list=1 |
|
732 | 733 |
|
733 | 734 |
|
734 | 735 |
################################# |
sql/Pg-upgrade2/todo_user_config.sql | ||
---|---|---|
1 |
-- @tag: todo_config |
|
2 |
-- @description: Benutzerkonfiguration zur Aufgabenliste |
|
3 |
-- @depends: release_2_4_3 |
|
4 |
|
|
5 |
CREATE TABLE todo_user_config ( |
|
6 |
employee_id integer NOT NULL, |
|
7 |
show_after_login boolean DEFAULT TRUE, |
|
8 |
show_follow_ups boolean DEFAULT TRUE, |
|
9 |
show_follow_ups_login boolean DEFAULT TRUE, |
|
10 |
show_overdue_sales_quotations boolean DEFAULT TRUE, |
|
11 |
show_overdue_sales_quotations_login boolean DEFAULT TRUE, |
|
12 |
|
|
13 |
FOREIGN KEY (employee_id) REFERENCES employee (id) |
|
14 |
); |
templates/webpages/am/config_de.html | ||
---|---|---|
8 | 8 |
<li class="selected"><a href="#" rel="page_personal_settings">Persönliche Einstellungen</a></li> |
9 | 9 |
<li><a href="#" rel="page_display_options">Anzeigeoptionen</a></li> |
10 | 10 |
<li><a href="#" rel="page_print_options">Druckoptionen</a></li> |
11 |
<li><a href="#" rel="page_todo_list_options">Aufgabenlistenoptionen</a></li> |
|
11 | 12 |
</ul> |
12 | 13 |
|
13 | 14 |
<input type="hidden" name="type" value="preferences"> |
... | ... | |
195 | 196 |
|
196 | 197 |
<br style="clear: left" /> |
197 | 198 |
</div> |
199 |
|
|
200 |
<div id="page_todo_list_options" class="tabcontent"> |
|
201 |
|
|
202 |
<table> |
|
203 |
<tr> |
|
204 |
<th align="right">Aufgabenliste nach dem Anmelden anzeigen</th> |
|
205 |
<td colspan="2"> |
|
206 |
<input type="radio" name="todo_cfg.show_after_login" id="todo_cfg_show_after_login_1" value="1"[% IF todo_cfg.show_after_login %] checked[% END %]> |
|
207 |
<label for="todo_cfg_show_after_login_1">Ja</label> |
|
208 |
<input type="radio" name="todo_cfg.show_after_login" id="todo_cfg_show_after_login_0" value="0"[% IF !todo_cfg.show_after_login %] checked[% END %]> |
|
209 |
<label for="todo_cfg_show_after_login_0">Nein</label> |
|
210 |
</td> |
|
211 |
</tr> |
|
212 |
|
|
213 |
<tr class="listheading"> |
|
214 |
<th colspan="3">Konfiguration für die einzelnen Aufgabenlistenpunkte</th> |
|
215 |
</tr> |
|
216 |
|
|
217 |
<tr> |
|
218 |
<th align="right">Zeige Wiedervorlagen...</th> |
|
219 |
<td> |
|
220 |
<input type="checkbox" name="todo_cfg.show_follow_ups" id="todo_cfg_show_follow_ups" value="1"[% IF todo_cfg.show_follow_ups %] checked[% END %]> |
|
221 |
<label for="todo_cfg_show_follow_ups">...auf der Aufgabenliste</label> |
|
222 |
</td> |
|
223 |
<td> |
|
224 |
<input type="checkbox" name="todo_cfg.show_follow_ups_login" id="todo_cfg_show_follow_ups_login" value="1"[% IF todo_cfg.show_follow_ups_login %] checked[% END %]> |
|
225 |
<label for="todo_cfg_show_follow_ups_login">...nach dem Anmelden</label> |
|
226 |
</td> |
|
227 |
</tr> |
|
228 |
|
|
229 |
[%- IF AUTH_RIGHTS_SALES_QUOTATION_EDIT %] |
|
230 |
<tr> |
|
231 |
<th align="right">Zeige überfällige Angebote...</th> |
|
232 |
<td> |
|
233 |
<input type="checkbox" name="todo_cfg.show_overdue_sales_quotations" id="todo_cfg_show_overdue_sales_quotations" value="1"[% IF todo_cfg.show_overdue_sales_quotations %] checked[% END %]> |
|
234 |
<label for="todo_cfg_show_overdue_sales_quotations">...auf der Aufgabenliste</label> |
|
235 |
</td> |
|
236 |
<td> |
|
237 |
<input type="checkbox" name="todo_cfg.show_overdue_sales_quotations_login" id="todo_cfg_show_overdue_sales_quotations_login" value="1"[% IF todo_cfg.show_overdue_sales_quotations_login %] checked[% END %]> |
|
238 |
<label for="todo_cfg_show_overdue_sales_quotations_login">...nach dem Anmelden</label> |
|
239 |
</td> |
|
240 |
</tr> |
|
241 |
[%- END %] |
|
242 |
</table> |
|
243 |
|
|
244 |
<br style="clear: left" /> |
|
245 |
</div> |
|
198 | 246 |
</div> |
199 | 247 |
|
200 | 248 |
<p><input type="submit" class="submit" name="action" value="Speichern"></p> |
templates/webpages/am/config_master.html | ||
---|---|---|
8 | 8 |
<li class="selected"><a href="#" rel="page_personal_settings"><translate>Personal settings</translate></a></li> |
9 | 9 |
<li><a href="#" rel="page_display_options"><translate>Display options</translate></a></li> |
10 | 10 |
<li><a href="#" rel="page_print_options"><translate>Print options</translate></a></li> |
11 |
<li><a href="#" rel="page_todo_list_options"><translate>TODO list options</translate></a></li> |
|
11 | 12 |
</ul> |
12 | 13 |
|
13 | 14 |
<input type="hidden" name="type" value="preferences"> |
... | ... | |
195 | 196 |
|
196 | 197 |
<br style="clear: left" /> |
197 | 198 |
</div> |
199 |
|
|
200 |
<div id="page_todo_list_options" class="tabcontent"> |
|
201 |
|
|
202 |
<table> |
|
203 |
<tr> |
|
204 |
<th align="right"><translate>Show your TODO list after loggin in</translate></th> |
|
205 |
<td colspan="2"> |
|
206 |
<input type="radio" name="todo_cfg.show_after_login" id="todo_cfg_show_after_login_1" value="1"[% IF todo_cfg.show_after_login %] checked[% END %]> |
|
207 |
<label for="todo_cfg_show_after_login_1"><translate>Yes</translate></label> |
|
208 |
<input type="radio" name="todo_cfg.show_after_login" id="todo_cfg_show_after_login_0" value="0"[% IF !todo_cfg.show_after_login %] checked[% END %]> |
|
209 |
<label for="todo_cfg_show_after_login_0"><translate>No</translate></label> |
|
210 |
</td> |
|
211 |
</tr> |
|
212 |
|
|
213 |
<tr class="listheading"> |
|
214 |
<th colspan="3"><translate>Configuration of individual TODO items</translate></th> |
|
215 |
</tr> |
|
216 |
|
|
217 |
<tr> |
|
218 |
<th align="right"><translate>Show follow ups...</translate></th> |
|
219 |
<td> |
|
220 |
<input type="checkbox" name="todo_cfg.show_follow_ups" id="todo_cfg_show_follow_ups" value="1"[% IF todo_cfg.show_follow_ups %] checked[% END %]> |
|
221 |
<label for="todo_cfg_show_follow_ups"><translate>...on the TODO list</translate></label> |
|
222 |
</td> |
|
223 |
<td> |
|
224 |
<input type="checkbox" name="todo_cfg.show_follow_ups_login" id="todo_cfg_show_follow_ups_login" value="1"[% IF todo_cfg.show_follow_ups_login %] checked[% END %]> |
|
225 |
<label for="todo_cfg_show_follow_ups_login"><translate>...after loggin in</translate></label> |
|
226 |
</td> |
|
227 |
</tr> |
|
228 |
|
|
229 |
[%- IF AUTH_RIGHTS_SALES_QUOTATION_EDIT %] |
|
230 |
<tr> |
|
231 |
<th align="right"><translate>Show overdue sales quotations...</translate></th> |
|
232 |
<td> |
|
233 |
<input type="checkbox" name="todo_cfg.show_overdue_sales_quotations" id="todo_cfg_show_overdue_sales_quotations" value="1"[% IF todo_cfg.show_overdue_sales_quotations %] checked[% END %]> |
|
234 |
<label for="todo_cfg_show_overdue_sales_quotations"><translate>...on the TODO list</translate></label> |
|
235 |
</td> |
|
236 |
<td> |
|
237 |
<input type="checkbox" name="todo_cfg.show_overdue_sales_quotations_login" id="todo_cfg_show_overdue_sales_quotations_login" value="1"[% IF todo_cfg.show_overdue_sales_quotations_login %] checked[% END %]> |
|
238 |
<label for="todo_cfg_show_overdue_sales_quotations_login"><translate>...after loggin in</translate></label> |
|
239 |
</td> |
|
240 |
</tr> |
|
241 |
[%- END %] |
|
242 |
</table> |
|
243 |
|
|
244 |
<br style="clear: left" /> |
|
245 |
</div> |
|
198 | 246 |
</div> |
199 | 247 |
|
200 | 248 |
<p><input type="submit" class="submit" name="action" value="<translate>Save</translate>"></p> |
Auch abrufbar als: Unified diff
Benutzerkonfiguration um Einstellungen zur Aufgabenliste erweitert.