Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 4bb02c5f

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID 4bb02c5fd3223620b08e01791a9205e12d695553
  • Vorgänger 67376071
  • Nachfolger c7f211c7

Admin-Bereich: Funktionen zum Aktualisieren von Datenbanken aus Admin-Bereich entfernt

Unterschiede anzeigen:

bin/mozilla/admin.pl
134 134
  call_sub($main::form->{"nextsub"});
135 135
}
136 136

  
137
sub update_dataset {
138
  my $form              = $main::form;
139
  my $locale            = $main::locale;
140

  
141
  $form->{title}        = "kivitendo " . $locale->text('Database Administration') . " / " . $locale->text('Update Dataset');
142

  
143
  my @need_updates      = User->dbneedsupdate($form);
144
  $form->{NEED_UPDATES} = \@need_updates;
145
  $form->{ALL_UPDATED}  = !scalar @need_updates;
146

  
147
  $form->header();
148
  print $form->parse_html_template("admin/update_dataset");
149
}
150

  
151
sub dbupdate {
152
  my $form            = $main::form;
153
  my $locale          = $main::locale;
154

  
155
  $::request->{layout}->use_stylesheet("lx-office-erp.css");
156
  $form->{title}      = $locale->text("Dataset upgrade");
157
  $form->header();
158

  
159
  my $rowcount           = $form->{rowcount} * 1;
160
  my @update_rows        = grep { $form->{"update_$_"} } (1 .. $rowcount);
161
  $form->{NOTHING_TO_DO} = !scalar @update_rows;
162
  my $saved_form         = save_form();
163

  
164
  $| = 1;
165

  
166
  print $form->parse_html_template("admin/dbupgrade_all_header");
167

  
168
  foreach my $i (@update_rows) {
169
    restore_form($saved_form);
170

  
171
    %::myconfig = ();
172
    map { $form->{$_} = $::myconfig{$_} = $form->{"${_}_${i}"} } qw(dbname dbhost dbport dbuser dbpasswd);
173

  
174
    print $form->parse_html_template("admin/dbupgrade_header");
175

  
176
    User->dbupdate($form);
177
    User->dbupdate2(form => $form, updater => SL::DBUpgrade2->new(form => $form)->parse_dbupdate_controls, database => $form->{dbname});
178

  
179
    print $form->parse_html_template("admin/dbupgrade_footer");
180
  }
181

  
182
  print $form->parse_html_template("admin/dbupgrade_all_done");
183
}
184 137

  
185 138
sub create_dataset {
186 139
  my $form           = $main::form;
templates/webpages/admin/dbupgrade_all_done.html
1
[%- USE T8 %]
2
[% USE HTML%][%- USE LxERP -%][%- USE L -%]
3
[% IF NOTHING_TO_DO %]
4
 <p>[% 'No datasets have been selected.' | $T8 %]</p>
5

  
6
 [% ELSE %]
7

  
8
 <hr>
9

  
10
 <p>[% 'All database upgrades have been applied.' | $T8 %]</p>
11
[% END %]
12

  
13
<p>[% L.link("controller.pl?action=Admin/show", LxERP.t8("Continue")) %]</p>
templates/webpages/admin/dbupgrade_all_header.html
1

  
templates/webpages/admin/dbupgrade_footer.html
1
[%- USE T8 %]
2
<p>[% '...done' | $T8 %]</p>
templates/webpages/admin/dbupgrade_header.html
1
[%- USE T8 %]
2
[% USE HTML %]<h1>[% 'Dataset upgrade' | $T8 %] ([% HTML.escape(dbname) %])</h1>
templates/webpages/admin/update_dataset.html
1
[%- USE T8 %]
2
[%- USE HTML %]
3
 <h1>[% title %]</h1>
4
 <p><a href="admin.pl?action=pg_database_administration">[% 'Back' | $T8 %]</a></p>
5
 [% IF ALL_UPDATED %]
6
  [% 'All Datasets up to date!' | $T8 %]
7

  
8
  [% ELSE %]
9

  
10
  <form method="post" action="admin.pl">
11

  
12
   <p>[% 'The following Datasets need to be updated' | $T8 %]:</p>
13

  
14
   <table>
15
    <tr>
16
     <th class="listtop">[% 'Update?' | $T8 %]</th>
17
     <th class="listtop">[% 'Driver' | $T8 %]</th>
18
     <th class="listtop">[% 'Host' | $T8 %]</th>
19
     <th class="listtop">[% 'Port' | $T8 %]</th>
20
     <th class="listtop">[% 'User' | $T8 %]</th>
21
    </tr>
22

  
23
    [% FOREACH row = NEED_UPDATES %]
24
     <tr class="listrow[% loop.count % 2 %]">
25
      <td><input type="checkbox" name="update_[% loop.count %]" id="update_[% loop.count %]" value="1" checked></td>
26
      <td>
27
       <input type="hidden" name="dbname_[% loop.count %]" value="[% HTML.escape(row.dbname) %]">
28
       <label for="update_[% loop.count %]">[% HTML.escape(row.dbname) %]</label>
29
      </td>
30
      <td><input type="hidden" name="dbhost_[% loop.count %]" value="[% HTML.escape(row.dbhost) %]">[% HTML.escape(row.dbhost) %]</td>
31
      <td><input type="hidden" name="dbport_[% loop.count %]" value="[% HTML.escape(row.dbport) %]">[% HTML.escape(row.dbport) %]</td>
32
      <td><input type="hidden" name="dbuser_[% loop.count %]" value="[% HTML.escape(row.dbuser) %]">[% HTML.escape(row.dbuser) %]</td>
33
     </tr>
34

  
35
    [% END %]
36
   </table>
37

  
38
   <input type="hidden" name="rowcount" value="[% NEED_UPDATES.size %]">
39

  
40
   <input name="callback" type="hidden" value="controller.pl?action=Admin/show">
41
   <input type="hidden" name="nextsub" value="dbupdate">
42

  
43
   <hr size="3" noshade>
44

  
45
   <br>
46

  
47
   <input type="submit" class="submit" name="action" value="[% 'Continue' | $T8 %]">
48

  
49
  </form>
50

  
51
 [% END %]

Auch abrufbar als: Unified diff