2 # TWiki Enterprise Collaboration Platform, http://TWiki.org/
4 # Copyright (C) 2000-2006 TWiki Contributors.
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version. For
10 # more details read LICENSE in the root of this distribution.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 # As per the GPL, removal of this notice is prohibited.
17 package TWiki::Configure::UIs::UPDATE;
18 use base 'TWiki::Configure::UI';
22 use TWiki::Configure::UI;
23 use TWiki::Configure::TWikiCfg;
26 my ($this, $root, $valuer, $updated) = @_;
29 $this->{updated} = $updated;
31 $this->{output} = CGI::h2('Updating configuration');
36 if (defined $TWiki::query) {
37 $this->{user} = $TWiki::query->remote_user() || '';
40 TWiki::Configure::TWikiCfg::save($root, $valuer, $this);
43 defined( $TWiki::cfg{ConfigurationLogName} ) &&
44 open(F, '>>'.$TWiki::cfg{ConfigurationLogName} )) {
49 # Put in a link to the front page of the TWiki
50 my $url = "$TWiki::cfg{DefaultUrlHost}$TWiki::cfg{ScriptUrlPath}/view$TWiki::cfg{ScriptSuffix}/";
51 return $this->{output}.CGI::p().CGI::strong(
52 'Setting ' . $this->{changed}.
53 ' configuration item' . (($this->{changed} == 1) ? '' : 's').'.').
55 CGI::a({ href => $url}, "Go to the TWiki front page")." or ";
58 # Listener for when a saved configuration item is changed.
60 my ($this, $keys, $value) = @_;
62 if ($this->{updated}->{$keys}) {
63 $this->{output} .= CGI::h3($keys).CGI::code($value);
65 $this->{log} .= '| '.gmtime().' | '.$this->{user}.' | '.$keys.' | '.