Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 58af8f75

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID 58af8f75b600ef09aed98b0709554816fcd27073
  • Vorgänger 790e4a45
  • Nachfolger 895309b3

Admin-Controller: Weiterführungslinks zu altem admin.pl gefixt

Unterschiede anzeigen:

SL/DB/AuthClient.pm
2 2

  
3 3
use strict;
4 4

  
5
use Carp;
6
use File::Path ();
7

  
5 8
use SL::DB::MetaSetup::AuthClient;
6 9
use SL::DB::Manager::AuthClient;
7 10
use SL::DB::Helper::Util;
......
23 26

  
24 27
__PACKAGE__->meta->initialize;
25 28

  
29
__PACKAGE__->before_save('_before_save_remember_old_name');
30
__PACKAGE__->after_save('_after_save_ensure_webdav_symlink_correctness');
31
__PACKAGE__->after_delete('_after_delete_delete_webdav_symlink');
32

  
33
sub _before_save_remember_old_name {
34
  my ($self) = @_;
35

  
36
  delete $self->{__before_save_remember_old_name};
37
  if ($self->id && $::lx_office_conf{features}->{webdav}) {
38
    $self->{__before_save_remember_old_name} = SL::DB::AuthClient->new(id => $self->id)->load->name;
39
  }
40

  
41
  return 1;
42
}
43

  
44
sub _after_save_ensure_webdav_symlink_correctness {
45
  my ($self) = @_;
46

  
47
  $self->ensure_webdav_symlink_correctness($self->{__before_save_remember_old_name}) if $self->id && $::lx_office_conf{features}->{webdav};
48
  return 1;
49
}
50

  
51
sub _after_delete_delete_webdav_symlink {
52
  my ($self) = @_;
53

  
54
  return 1 if !$::lx_office_conf{features}->{webdav};
55
  my $name = $self->webdav_symlink_basename;
56
  unlink "webdav/links/${name}";
57
  return 1;
58
}
59

  
26 60
sub validate {
27 61
  my ($self) = @_;
28 62

  
......
38 72
  return @errors;
39 73
}
40 74

  
75
sub webdav_symlink_basename {
76
  my ($self, $name) =  @_;
77

  
78
  $name             =  $name || $self->name || '';
79
  $name             =~ s:/+:_:g;
80

  
81
  return $name;
82
}
83

  
84
sub ensure_webdav_symlink_correctness {
85
  my ($self, $old_name) = @_;
86

  
87
  return unless $::lx_office_conf{features}->{webdav};
88

  
89
  croak "Need object ID" unless $self->id;
90

  
91
  my $new_symlink = $self->webdav_symlink_basename;
92

  
93
  croak "Need name" unless $new_symlink;
94

  
95
  my $base_path = 'webdav/links';
96

  
97
  if ($old_name) {
98
    my $old_symlink = $self->webdav_symlink_basename($old_name);
99
    return if $old_symlink eq $new_symlink;
100

  
101
    if (-l "${base_path}/${old_symlink}") {
102
      rename "${base_path}/${old_symlink}", "${base_path}/${new_symlink}";
103
      return;
104
    }
105
  }
106

  
107
  File::Path::make_path('webdav/' . $self->id);
108
  symlink '../' . $self->id, "${base_path}/${new_symlink}";
109
}
110

  
41 111
1;
bin/mozilla/admin_printer.pl
20 20
}
21 21

  
22 22
sub printer_dispatcher {
23
  for my $action (qw(get_login_form list_printers add_printer edit_printer save_printer delete_printer list_users)) {
23
  for my $action (qw(get_login_form list_printers add_printer edit_printer save_printer delete_printer)) {
24 24
    if ($::form->{$action}) {
25 25
      ::call_sub($::locale->findsub($action));
26 26
      ::end_of_request()
templates/webpages/admin/create_dataset.html
90 90
   <input type="hidden" name="dbpasswd"  value="[% HTML.escape(dbpasswd) %]">
91 91
   <input type="hidden" name="dbdefault" value="[% HTML.escape(dbdefault) %]">
92 92

  
93
   <input type="hidden" name="callback" value="admin.pl?action=list_users">
93
   <input type="hidden" name="callback" value="controller.pl?action=Admin/show">
94 94

  
95 95
   <input type="hidden" name="nextsub" value="dbcreate">
96 96

  
templates/webpages/admin_printer/login.html
9 9

  
10 10
<input type='hidden' name='action' value='printer_dispatcher'>
11 11
<p>
12
<input type='submit' name='list_users' value='[% 'Back' | $T8 %]'>
12
 <a href="controller.pl?action=Admin/show">[% 'Back' | $T8 %]</a>
13 13
<input type='submit' name='list_printers' value='[% 'Continue' | $T8 %]'>
14 14
</p>
15 15

  
templates/webpages/dbupgrade/auth/clients.html
25 25
 [% LxERP.t8("It can be changed later but must be unique within the installation.") %]
26 26
</p>
27 27

  
28
<form method="post" action="admin.pl">
28
<form method="post" action="controller.pl">
29 29
 [%- FOREACH client = SELF.clients %]
30 30
 [%- L.hidden_tag("clients[+].dummy", 1) %]
31 31

  
......
118 118
 [%- END %]
119 119

  
120 120
 <p>
121
  [%- L.hidden_tag('action', 'list_users') %]
121
  [%- L.hidden_tag('action', 'Admin/apply_dbupgrade_scripts') %]
122 122
  [% L.submit_tag('dummy', LxERP.t8('Continue')) %]
123 123
 </p>
124 124
</form>

Auch abrufbar als: Unified diff