+
+sub yes {
+ call_sub($main::form->{yes_nextsub});
+}
+
+sub no {
+ call_sub($main::form->{no_nextsub});
+}
+
+sub add {
+ call_sub($main::form->{add_nextsub});
+}
+
+sub edit {
+ my $form = $main::form;
+
+ $form->{edit_nextsub} ||= 'edit_user';
+
+ call_sub($form->{edit_nextsub});
+}
+
+sub delete {
+ my $form = $main::form;
+
+ $form->{delete_nextsub} ||= 'delete_user';
+
+ call_sub($form->{delete_nextsub});
+}
+
+sub save {
+ my $form = $main::form;
+
+ $form->{save_nextsub} ||= 'save_user';
+
+ call_sub($form->{save_nextsub});
+}
+
+sub back {
+ call_sub($main::form->{back_nextsub});
+}
+
+sub dispatcher {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ foreach my $action (qw(create_standard_group dont_create_standard_group
+ save_user delete_user save_user_as_new)) {
+ if ($form->{"action_${action}"}) {
+ call_sub($action);
+ return;
+ }
+ }
+
+ call_sub($form->{default_action}) if ($form->{default_action});
+
+ $form->error($locale->text('No action defined.'));
+}
+
+sub _apply_dbupgrade_scripts {
+ ::end_of_request() if SL::DBUpgrade2->new(form => $::form, dbdriver => 'Pg', auth => 1)->apply_admin_dbupgrade_scripts(1);
+}
+
+sub _nologin_file_name {
+ return $::lx_office_conf{paths}->{userspath} . '/nologin';
+}
+
+sub _search_templates {
+ # is there a templates basedir
+ if (!-d $::lx_office_conf{paths}->{templates}) {
+ $::form->error(sprintf($::locale->text("The directory %s does not exist."), $::lx_office_conf{paths}->{templates}));
+ }
+
+ opendir TEMPLATEDIR, $::lx_office_conf{paths}->{templates} or $::form->error($::lx_office_conf{paths}->{templates} . " : $ERRNO");
+ my @all = readdir(TEMPLATEDIR);
+ my @alldir = sort grep { -d ($::lx_office_conf{paths}->{templates} . "/$_") && !/^\.\.?$/ } @all;
+ closedir TEMPLATEDIR;
+
+ @alldir = grep !/\.(html|tex|sty|odt|xml|txb)$/, @alldir;
+ @alldir = grep !/^(webpages|print|\.svn)$/, @alldir;
+
+ # mastertemplates
+ opendir TEMPLATEDIR, "$::lx_office_conf{paths}->{templates}/print" or $::form->error("$::lx_office_conf{paths}->{templates}/print" . " : $ERRNO");
+ my @allmaster = readdir(TEMPLATEDIR);
+ closedir TEMPLATEDIR;
+
+ @allmaster = sort grep { -d ("$::lx_office_conf{paths}->{templates}/print" . "/$_") && !/^\.\.?$/ } @allmaster;
+ @allmaster = reverse grep !/Default/, @allmaster;
+ push @allmaster, 'Default';
+ @allmaster = reverse @allmaster;
+
+ return \@alldir, \@allmaster;
+}
+
+1;