Umstellung der Benutzerverwaltung von Dateien im Verzeichnis "users" auf die Verwendu...
[kivitendo-erp.git] / bin / mozilla / pe.pl
1 #=====================================================================
2 # LX-Office ERP
3 # Copyright (C) 2004
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
6 #
7 #=====================================================================
8 # SQL-Ledger Accounting
9 # Copyright (c) 1998-2002
10 #
11 #  Author: Dieter Simader
12 #   Email: dsimader@sql-ledger.org
13 #     Web: http://www.sql-ledger.org
14 #
15 #
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2 of the License, or
19 # (at your option) any later version.
20 #
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #======================================================================
29 #
30 # project administration
31 # partsgroup administration
32 #
33 #======================================================================
34
35 use SL::PE;
36
37 require "bin/mozilla/common.pl";
38
39 1;
40
41 # end of main
42
43 sub add {
44   $lxdebug->enter_sub();
45
46   $auth->assert('config');
47
48   $form->{title} = "Add";
49
50   # construct callback
51   $form->{callback} =
52     "$form->{script}?action=add&type=$form->{type}&login=$form->{login}&password=$form->{password}"
53     unless $form->{callback};
54
55   call_sub("form_$form->{type}_header");
56   call_sub("form_$form->{type}_footer");
57
58   $lxdebug->leave_sub();
59 }
60
61 sub edit {
62   $lxdebug->enter_sub();
63
64   $auth->assert('config');
65
66   # show history button
67   $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
68   #/show hhistory button
69   $form->{title} = "Edit";
70
71   if ($form->{type} eq 'project') {
72     PE->get_project(\%myconfig, \%$form);
73   }
74   if ($form->{type} eq 'partsgroup') {
75     PE->get_partsgroup(\%myconfig, \%$form);
76   }
77   if ($form->{type} eq 'pricegroup') {
78     PE->get_pricegroup(\%myconfig, \%$form);
79   }
80   call_sub("form_$form->{type}_header");
81   call_sub("form_$form->{type}_footer");
82
83   $lxdebug->leave_sub();
84 }
85
86 sub search {
87   $lxdebug->enter_sub();
88
89   $auth->assert('config');
90
91   if ($form->{type} eq 'project') {
92     $report        = "project_report";
93     $sort          = 'projectnumber';
94     $form->{title} = $locale->text('Projects');
95
96     $number = qq|
97         <tr>
98           <th align=right width=1%>| . $locale->text('Number') . qq|</th>
99           <td>| . $cgi->textfield('-name' => 'projectnumber', '-size' => 20) . qq|</td>
100         </tr>
101         <tr>
102           <th align=right>| . $locale->text('Description') . qq|</th>
103           <td>| . $cgi->textfield('-name' => 'description', '-size' => 60) . qq|</td>
104         </tr>
105   <tr>
106     <th>&nbsp;</th>
107     <td>| .
108     $cgi->radio_group('-name' => 'active', '-default' => 'active',
109                       '-values' => ['active', 'inactive', 'both'],
110                       '-labels' => { 'active' => ' ' . $locale->text("Active"),
111                                      'inactive' => ' ' . $locale->text("Inactive"),
112                                      'both' => ' ' . $locale->text("Both") })
113     . qq|</td>
114   </tr>
115 |;
116
117   }
118   if ($form->{type} eq 'partsgroup') {
119     $report        = "partsgroup_report";
120     $sort          = 'partsgroup';
121     $form->{title} = $locale->text('Groups');
122
123     $number = qq|
124         <tr>
125           <th align=right width=1%>| . $locale->text('Group') . qq|</th>
126           <td><input name=partsgroup size=20></td>
127         </tr>
128 |;
129
130   }
131
132   # for pricesgroups
133   if ($form->{type} eq 'pricegroup') {
134     $report        = "pricegroup_report";
135     $sort          = 'pricegroup';
136     $form->{title} = $locale->text('Pricegroup');
137
138     $number = qq|
139         <tr>
140           <th align=right width=1%>| . $locale->text('Pricegroup') . qq|</th>
141           <td><input name=pricegroup size=20></td>
142         </tr>
143 |;
144
145   }
146
147   $form->header;
148
149   print qq|
150 <body>
151
152 <form method=post action=$form->{script}>
153
154 <input type=hidden name=sort value=$sort>
155 <input type=hidden name=type value=$form->{type}>
156
157 <table width=100%>
158   <tr>
159     <th class=listtop>$form->{title}</th>
160   </tr>
161   <tr height="5"></tr>
162   <tr>
163     <td>
164       <table width=100%>
165         $number
166         <tr>
167           <td></td>
168           <td><input name=status class=radio type=radio value=all checked>&nbsp;|
169     . $locale->text('All') . qq|
170           <input name=status class=radio type=radio value=orphaned>&nbsp;|
171     . $locale->text('Orphaned') . qq|</td>
172         </tr>
173       </table>
174     </td>
175   </tr>
176   <tr>
177     <td><hr size=3 noshade></td>
178   </tr>
179 </table>
180
181 <input type=hidden name=nextsub value=$report>
182
183 <input type=hidden name=login value=$form->{login}>
184 <input type=hidden name=password value=$form->{password}>
185
186 <br>
187 <input class=submit type=submit name=action value="|
188     . $locale->text('Continue') . qq|">
189 </form>
190
191 </body>
192 </html>
193 |;
194
195   $lxdebug->leave_sub();
196 }
197
198 sub project_report {
199   $lxdebug->enter_sub();
200
201   $auth->assert('config');
202
203   map { $form->{$_} = $form->unescape($form->{$_}) }
204     (projectnumber, description);
205   PE->projects(\%myconfig, \%$form);
206
207   $callback =
208     "$form->{script}?action=project_report&type=$form->{type}&login=$form->{login}&password=$form->{password}&status=$form->{status}&active=" .
209     E($form->{active});
210   $href = $callback;
211
212   if ($form->{status} eq 'all') {
213     $option = $locale->text('All');
214   }
215   if ($form->{status} eq 'orphaned') {
216     $option .= $locale->text('Orphaned');
217   }
218   if ($form->{projectnumber}) {
219     $href     .= "&projectnumber=" . $form->escape($form->{projectnumber});
220     $callback .= "&projectnumber=$form->{projectnumber}";
221     $option   .=
222       "\n<br>" . $locale->text('Project') . " : $form->{projectnumber}";
223   }
224   if ($form->{description}) {
225     $href     .= "&description=" . $form->escape($form->{description});
226     $callback .= "&description=$form->{description}";
227     $option   .=
228       "\n<br>" . $locale->text('Description') . " : $form->{description}";
229   }
230
231   @column_index = qw(projectnumber description);
232
233   push(@column_index, "active") if ("both" eq $form->{active});
234
235   $column_header{projectnumber} =
236       qq|<th><a class=listheading href=$href&sort=projectnumber>|
237     . $locale->text('Number')
238     . qq|</a></th>|;
239   $column_header{description} =
240       qq|<th><a class=listheading href=$href&sort=description>|
241     . $locale->text('Description')
242     . qq|</a></th>|;
243   $column_header{active} =
244       qq|<th class="listheading">| . $locale->text('Active') . qq|</th>|;
245
246   $form->{title} = $locale->text('Projects');
247
248   $form->header;
249
250   print qq|
251 <body>
252
253 <table width=100%>
254   <tr>
255     <th class=listtop>$form->{title}</th>
256   </tr>
257   <tr height="5"></tr>
258   <tr>
259     <td>$option</td>
260   </tr>
261   <tr>
262     <td>
263       <table width=100%>
264         <tr class=listheading>
265 |;
266
267   map { print "$column_header{$_}\n" } @column_index;
268
269   print qq|
270         </tr>
271 |;
272
273   # escape callback
274   $form->{callback} = $callback .= "&sort=$form->{sort}";
275
276   # escape callback for href
277   $callback = $form->escape($callback);
278
279   foreach $ref (@{ $form->{project_list} }) {
280
281     $i++;
282     $i %= 2;
283
284     print qq|
285         <tr valign=top class=listrow$i>
286 |;
287
288     $column_data{projectnumber} =
289       qq|<td><a href=$form->{script}?action=edit&type=$form->{type}&status=$form->{status}&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{projectnumber}</td>|;
290     $column_data{description} = qq|<td>$ref->{description}&nbsp;</td>|;
291     $column_data{active} =
292       qq|<td>| .
293       ($ref->{active} ? $locale->text("Yes") : $locale->text("No")) .
294       qq|</td>|;
295
296     map { print "$column_data{$_}\n" } @column_index;
297
298     print "
299         </tr>
300 ";
301   }
302
303   print qq|
304       </table>
305     </td>
306   </tr>
307   <tr>
308     <td><hr size=3 noshade></td>
309   </tr>
310 </table>
311
312 <br>
313 <form method=post action=$form->{script}>
314
315 <input name=callback type=hidden value="$form->{callback}">
316
317 <input type=hidden name=type value=$form->{type}>
318
319 <input type=hidden name=login value=$form->{login}>
320 <input type=hidden name=password value=$form->{password}>
321
322 <input class=submit type=submit name=action value="|
323     . $locale->text('Add') . qq|">
324
325   </form>
326
327 </body>
328 </html>
329 |;
330
331   $lxdebug->leave_sub();
332 }
333
334 sub form_project_header {
335   $lxdebug->enter_sub();
336
337   $auth->assert('config');
338
339   $form->{title} = $locale->text("$form->{title} Project");
340
341   # $locale->text('Add Project')
342   # $locale->text('Edit Project')
343
344   $form->{description} =~ s/\"/&quot;/g;
345
346   my $projectnumber =
347     $cgi->textfield('-name' => 'projectnumber', '-size' => 20,
348                     '-default' => $form->{projectnumber});
349
350   my $description;
351   if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
352     $description =
353       $cgi->textarea('-name' => 'description', '-rows' => $rows, '-cols' => 60,
354                      '-style' => 'width: 100%', '-wrap' => 'soft',
355                      '-default' => $form->{description});
356   } else {
357     $description =
358       $cgi->textfield('-name' => 'description', '-size' => 60,
359                       '-default' => $form->{description});
360   }
361
362   my $active;
363   if ($form->{id}) {
364     $active =
365       qq|
366   <tr>
367     <th>&nbsp;</th>
368     <td>| .
369       $cgi->radio_group('-name' => 'active',
370                         '-values' => [1, 0],
371                         '-default' => $form->{active} * 1,
372                         '-labels' => { 1 => $locale->text("Active"),
373                                        0 => $locale->text("Inactive") })
374       . qq|</td>
375   </tr>
376 |;
377   }
378
379   $form->header;
380
381   print qq|
382 <body>
383
384 <form method=post action=$form->{script}>
385
386 <input type=hidden name=id value=$form->{id}>
387 <input type=hidden name=type value=project>
388
389 <table width=100%>
390   <tr>
391     <th class=listtop>$form->{title}</th>
392   </tr>
393   <tr height="5"></tr>
394   <tr>
395     <td>
396       <table>
397         <tr>
398           <th align=right>| . $locale->text('Number') . qq|</th>
399           <td>$projectnumber</td>
400         </tr>
401         <tr>
402           <th align=right>| . $locale->text('Description') . qq|</th>
403           <td>$description</td>
404         </tr>
405       $active
406       </table>
407     </td>
408   </tr>
409   <tr>
410     <td colspan=2><hr size=3 noshade></td>
411   </tr>
412 </table>
413 |;
414
415   $lxdebug->leave_sub();
416 }
417
418 sub form_project_footer {
419   $lxdebug->enter_sub();
420
421   $auth->assert('config');
422
423   print qq|
424
425 <input name=callback type=hidden value="$form->{callback}">
426
427 <input type=hidden name=login value=$form->{login}>
428 <input type=hidden name=password value=$form->{password}>
429
430 <br><input type=submit class=submit name=action value="|
431     . $locale->text('Save') . qq|">
432 |;
433
434   if ($form->{id} && $form->{orphaned}) {
435     print qq|
436 <input type=submit class=submit name=action value="|
437       . $locale->text('Delete') . qq|">|;
438   }
439
440   if ($form->{id}) {
441     # button for saving history
442     print qq|
443       <input type=button onclick=set_history_window(|
444       . $form->{id}
445       . qq|); name=history id=history value=|
446       . $locale->text('history')
447       . qq|>|;
448     # /button for saving history
449   }
450
451   print qq|
452 </form>
453
454 </body>
455 </html>
456 |;
457
458   $lxdebug->leave_sub();
459 }
460
461 sub save {
462   $lxdebug->enter_sub();
463
464   $auth->assert('config');
465
466   if ($form->{type} eq 'project') {
467     $form->isblank("projectnumber", $locale->text('Project Number missing!'));
468     PE->save_project(\%myconfig, \%$form);
469     $form->redirect($locale->text('Project saved!'));
470   }
471   if ($form->{type} eq 'partsgroup') {
472     $form->isblank("partsgroup", $locale->text('Group missing!'));
473     PE->save_partsgroup(\%myconfig, \%$form);
474     $form->redirect($locale->text('Group saved!'));
475   }
476
477   # choice pricegroup and save
478   if ($form->{type} eq 'pricegroup') {
479     $form->isblank("pricegroup", $locale->text('Pricegroup missing!'));
480     PE->save_pricegroup(\%myconfig, \%$form);
481     $form->redirect($locale->text('Pricegroup saved!'));
482   }
483   # saving the history
484   if(!exists $form->{addition} && $form->{id} ne "") {
485     $form->{snumbers} = qq|projectnumber_| . $form->{projectnumber};
486         $form->{addition} = "SAVED";
487         $form->save_history($form->dbconnect(\%myconfig));
488   }
489   # /saving the history 
490
491   $lxdebug->leave_sub();
492 }
493
494 sub delete {
495   $lxdebug->enter_sub();
496
497   $auth->assert('config');
498
499   PE->delete_tuple(\%myconfig, \%$form);
500
501   if ($form->{type} eq 'project') {
502     $form->redirect($locale->text('Project deleted!'));
503   }
504   if ($form->{type} eq 'partsgroup') {
505     $form->redirect($locale->text('Group deleted!'));
506   }
507   if ($form->{type} eq 'pricegroup') {
508     $form->redirect($locale->text('Pricegroup deleted!'));
509   }
510   # saving the history
511   if(!exists $form->{addition}) {
512     $form->{snumbers} = qq|projectnumber_| . $form->{projectnumber};
513         $form->{addition} = "DELETED";
514         $form->save_history($form->dbconnect(\%myconfig));
515   }
516   # /saving the history
517   $lxdebug->leave_sub();
518 }
519
520 sub continue { call_sub($form->{"nextsub"}); }
521
522 sub partsgroup_report {
523   $lxdebug->enter_sub();
524
525   $auth->assert('config');
526
527   map { $form->{$_} = $form->unescape($form->{$_}) } (partsgroup);
528   PE->partsgroups(\%myconfig, \%$form);
529
530   $callback =
531     "$form->{script}?action=partsgroup_report&type=$form->{type}&login=$form->{login}&password=$form->{password}&status=$form->{status}";
532
533   if ($form->{status} eq 'all') {
534     $option = $locale->text('All');
535   }
536   if ($form->{status} eq 'orphaned') {
537     $option .= $locale->text('Orphaned');
538   }
539   if ($form->{partsgroup}) {
540     $callback .= "&partsgroup=$form->{partsgroup}";
541     $option   .= "\n<br>" . $locale->text('Group') . " : $form->{partsgroup}";
542   }
543
544   @column_index = $form->sort_columns(qw(partsgroup));
545
546   $column_header{partsgroup} =
547     qq|<th class=listheading width=90%>| . $locale->text('Group') . qq|</th>|;
548
549   $form->{title} = $locale->text('Groups');
550
551   $form->header;
552
553   print qq|
554 <body>
555
556 <table width=100%>
557   <tr>
558     <th class=listtop>$form->{title}</th>
559   </tr>
560   <tr height="5"></tr>
561   <tr>
562     <td>$option</td>
563   </tr>
564   <tr>
565     <td>
566       <table width=100%>
567         <tr class=listheading>
568 |;
569
570   map { print "$column_header{$_}\n" } @column_index;
571
572   print qq|
573         </tr>
574 |;
575
576   # escape callback
577   $form->{callback} = $callback;
578
579   # escape callback for href
580   $callback = $form->escape($callback);
581
582   foreach $ref (@{ $form->{item_list} }) {
583
584     $i++;
585     $i %= 2;
586
587     print qq|
588         <tr valign=top class=listrow$i>
589 |;
590
591     $column_data{partsgroup} =
592       qq|<td><a href=$form->{script}?action=edit&type=$form->{type}&status=$form->{status}&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{partsgroup}</td>|;
593     map { print "$column_data{$_}\n" } @column_index;
594
595     print "
596         </tr>
597 ";
598   }
599
600   print qq|
601       </table>
602     </td>
603   </tr>
604   <tr>
605     <td><hr size=3 noshade></td>
606   </tr>
607 </table>
608
609 <br>
610 <form method=post action=$form->{script}>
611
612 <input name=callback type=hidden value="$form->{callback}">
613
614 <input type=hidden name=type value=$form->{type}>
615
616 <input type=hidden name=login value=$form->{login}>
617 <input type=hidden name=password value=$form->{password}>
618
619 <input class=submit type=submit name=action value="|
620     . $locale->text('Add') . qq|">
621
622   </form>
623
624 </body>
625 </html>
626 |;
627
628   $lxdebug->leave_sub();
629 }
630
631 sub form_partsgroup_header {
632   $lxdebug->enter_sub();
633
634   $auth->assert('config');
635
636   $form->{title} = $locale->text("$form->{title} Group");
637
638   # $locale->text('Add Group')
639   # $locale->text('Edit Group')
640
641   $form->{partsgroup} =~ s/\"/&quot;/g;
642
643   $form->header;
644
645   print qq|
646 <body>
647
648 <form method=post action=$form->{script}>
649
650 <input type=hidden name=id value=$form->{id}>
651 <input type=hidden name=type value=$form->{type}>
652
653 <table width=100%>
654   <tr>
655     <th class=listtop>$form->{title}</th>
656   </tr>
657   <tr height="5"></tr>
658   <tr>
659     <td>
660       <table width=100%>
661         <tr>
662           <th align=right>| . $locale->text('Group') . qq|</th>
663
664           <td><input name=partsgroup size=30 value="$form->{partsgroup}"></td>
665         </tr>
666       </table>
667     </td>
668   </tr>
669   <tr>
670     <td colspan=2><hr size=3 noshade></td>
671   </tr>
672 </table>
673 |;
674
675   $lxdebug->leave_sub();
676 }
677
678 sub form_partsgroup_footer {
679   $lxdebug->enter_sub();
680
681   $auth->assert('config');
682
683   print qq|
684
685 <input name=callback type=hidden value="$form->{callback}">
686
687 <input type=hidden name=login value=$form->{login}>
688 <input type=hidden name=password value=$form->{password}>
689
690 <br><input type=submit class=submit name=action value="|
691     . $locale->text('Save') . qq|">
692 |;
693
694   if ($form->{id} && $form->{orphaned}) {
695     print qq|
696 <input type=submit class=submit name=action value="|
697       . $locale->text('Delete') . qq|">|;
698   }
699
700 # button for saving history
701 print qq|
702         <input type=button onclick=set_history_window(|
703         . $form->{id} 
704         . qq|); name=history id=history value=|
705         . $locale->text('history') 
706         . qq|>|;
707 # /button for saving history
708   print qq|
709 </form>
710
711 </body>
712 </html>
713 |;
714
715   $lxdebug->leave_sub();
716 }
717
718 #################################
719 # get pricesgroups and build up html-code
720 #
721 sub pricegroup_report {
722   $lxdebug->enter_sub();
723
724   $auth->assert('config');
725
726   map { $form->{$_} = $form->unescape($form->{$_}) } (pricegroup);
727   PE->pricegroups(\%myconfig, \%$form);
728
729   $callback =
730     "$form->{script}?action=pricegroup_report&type=$form->{type}&login=$form->{login}&password=$form->{password}&status=$form->{status}";
731
732   if ($form->{status} eq 'all') {
733     $option = $locale->text('All');
734   }
735   if ($form->{status} eq 'orphaned') {
736     $option .= $locale->text('Orphaned');
737   }
738   if ($form->{pricegroup}) {
739     $callback .= "&pricegroup=$form->{pricegroup}";
740     $option   .=
741       "\n<br>" . $locale->text('Pricegroup') . " : $form->{pricegroup}";
742   }
743
744   @column_index = $form->sort_columns(qw(pricegroup));
745
746   $column_header{pricegroup} =
747       qq|<th class=listheading width=90%>|
748     . $locale->text('Pricegroup')
749     . qq|</th>|;
750
751   $form->{title} = $locale->text('Pricegroup');
752
753   $form->header;
754
755   print qq|
756 <body>
757
758 <table width=100%>
759   <tr>
760     <th class=listtop>$form->{title}</th>
761   </tr>
762   <tr height="5"></tr>
763   <tr>
764     <td>$option</td>
765   </tr>
766   <tr>
767     <td>
768       <table width=100%>
769         <tr class=listheading>
770 |;
771
772   map { print "$column_header{$_}\n" } @column_index;
773
774   print qq|
775         </tr>
776 |;
777
778   # escape callback
779   $form->{callback} = $callback;
780
781   # escape callback for href
782   $callback = $form->escape($callback);
783
784   foreach $ref (@{ $form->{item_list} }) {
785
786     $i++;
787     $i %= 2;
788
789     print qq|
790         <tr valign=top class=listrow$i>
791 |;
792     $column_data{pricegroup} =
793       qq|<td><a href=$form->{script}?action=edit&type=$form->{type}&status=$form->{status}&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{pricegroup}</td>|;
794
795     map { print "$column_data{$_}\n" } @column_index;
796
797     print "
798         </tr>
799 ";
800   }
801
802   print qq|
803       </table>
804     </td>
805   </tr>
806   <tr>
807     <td><hr size=3 noshade></td>
808   </tr>
809 </table>
810
811 <br>
812 <form method=post action=$form->{script}>
813
814 <input name=callback type=hidden value="$form->{callback}">
815
816 <input type=hidden name=type value=$form->{type}>
817
818 <input type=hidden name=login value=$form->{login}>
819 <input type=hidden name=password value=$form->{password}>
820
821 <input class=submit type=submit name=action value="|
822     . $locale->text('Add') . qq|">
823
824   </form>
825
826 </body>
827 </html>
828 |;
829
830   $lxdebug->leave_sub();
831 }
832
833 #######################
834 #build up pricegroup_header
835 #
836 sub form_pricegroup_header {
837   $lxdebug->enter_sub();
838
839   $auth->assert('config');
840
841   # $locale->text('Add Pricegroup')
842   # $locale->text('Edit Pricegroup')
843
844   $form->{title} = $locale->text("$form->{title} Pricegroup");
845
846   $form->{pricegroup} =~ s/\"/&quot;/g;
847
848   $form->header;
849
850   print qq|
851 <body>
852
853 <form method=post action=$form->{script}>
854
855 <input type=hidden name=id value=$form->{id}>
856 <input type=hidden name=type value=$form->{type}>
857
858 <table width=100%>
859   <tr>
860     <th class=listtop>$form->{title}</th>
861   </tr>
862   <tr height="5"></tr>
863   <tr>
864     <td>
865       <table width=100%>
866         <tr>
867           <th align=right>| . $locale->text('Preisgruppe') . qq|</th>
868           <td><input name=pricegroup size=30 value="$form->{pricegroup}"></td>
869         </tr>
870       </table>
871     </td>
872   </tr>
873   <tr>
874     <td colspan=2><hr size=3 noshade></td>
875   </tr>
876 </table>
877 |;
878
879   $lxdebug->leave_sub();
880 }
881 ######################
882 #build up pricegroup_footer
883 #
884 sub form_pricegroup_footer {
885   $lxdebug->enter_sub();
886
887   $auth->assert('config');
888
889   print qq|
890
891 <input name=callback type=hidden value="$form->{callback}">
892
893 <input type=hidden name=login value=$form->{login}>
894 <input type=hidden name=password value=$form->{password}>
895
896 <br><input type=submit class=submit name=action value="|
897     . $locale->text('Save') . qq|">
898 |;
899
900   if ($form->{id} && $form->{orphaned}) {
901     print qq|
902 <input type=submit class=submit name=action value="|
903       . $locale->text('Delete') . qq|">|;
904   }
905
906 # button for saving history
907 print qq|
908         <input type=button onclick=set_history_window(|
909         . $form->{id} 
910         . qq|); name=history id=history value=|
911         . $locale->text('history') 
912         . qq|>|;
913 # /button for saving history
914   print qq|
915 </form>
916
917 </body>
918 </html>
919 |;
920
921   $lxdebug->leave_sub();
922 }