lib/TWiki/Configure/UIs/FINDEXTENSIONS.pm
author Colas Nahaboo <colas@nahaboo.net>
Sat, 26 Jan 2008 15:50:53 +0100
changeset 0 414e01d06fd5
permissions -rw-r--r--
RELEASE 4.2.0 freetown
colas@0
     1
#
colas@0
     2
# TWiki Enterprise Collaboration Platform, http://TWiki.org/
colas@0
     3
#
colas@0
     4
# Copyright (C) 2000-2006 TWiki Contributors.
colas@0
     5
#
colas@0
     6
# This program is free software; you can redistribute it and/or
colas@0
     7
# modify it under the terms of the GNU General Public License
colas@0
     8
# as published by the Free Software Foundation; either version 2
colas@0
     9
# of the License, or (at your option) any later version. For
colas@0
    10
# more details read LICENSE in the root of this distribution.
colas@0
    11
#
colas@0
    12
# This program is distributed in the hope that it will be useful,
colas@0
    13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
colas@0
    14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
colas@0
    15
#
colas@0
    16
# As per the GPL, removal of this notice is prohibited.
colas@0
    17
package TWiki::Configure::UIs::FINDEXTENSIONS;
colas@0
    18
use base 'TWiki::Configure::UIs::Section';
colas@0
    19
colas@0
    20
use strict;
colas@0
    21
use TWiki::Configure::Type;
colas@0
    22
colas@0
    23
sub close_html {
colas@0
    24
    my ($this, $section) = @_;
colas@0
    25
colas@0
    26
    my $button = <<HERE;
colas@0
    27
Consult online extensions repositories for
colas@0
    28
new extensions. <b>If you made any changes, save them first!<b>
colas@0
    29
HERE
colas@0
    30
    # Check that the extensions UI is loadable
colas@0
    31
    my $bad = 0;
colas@0
    32
    foreach my $module qw(TWiki::Configure::UIs::EXTEND TWiki::Configure::UIs::FINDEXTENSIONS) {
colas@0
    33
        eval "require $module";
colas@0
    34
        if ($@) {
colas@0
    35
            $bad = 1;
colas@0
    36
            last;
colas@0
    37
        }
colas@0
    38
    }
colas@0
    39
    my $actor;
colas@0
    40
    if (!$bad) {
colas@0
    41
        # Can't use a submit here, because if we do, it is invoked when
colas@0
    42
        # the user presses Enter in a text field.
colas@0
    43
        my @script = File::Spec->splitdir($ENV{SCRIPT_NAME} || 'THISSCRIPT');
colas@0
    44
        my $scriptName = pop(@script);
colas@0
    45
        $scriptName =~ s/.*[\/\\]//;  # Fix for Item3511, on Win XP
colas@0
    46
colas@0
    47
        $actor = CGI::a({ href => $scriptName.'?action=FindMoreExtensions',
colas@0
    48
                          class=>'twikiSubmit',
colas@0
    49
                          accesskey => 'P' },
colas@0
    50
                        'Find More Extensions');
colas@0
    51
    } else {
colas@0
    52
        $actor = $this->WARN(<<MESSAGE);
colas@0
    53
Cannot load the extensions installer.
colas@0
    54
Check 'Perl Modules' in the 'CGI Setup' section above, and install any
colas@0
    55
missing modules required for the Extensions Installer.
colas@0
    56
MESSAGE
colas@0
    57
    }
colas@0
    58
    return CGI::Tr(CGI::td($button),CGI::td($actor)).
colas@0
    59
      $this->SUPER::close_html($section);
colas@0
    60
}
colas@0
    61
colas@0
    62
1;