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
     1 #
     2 # TWiki Enterprise Collaboration Platform, http://TWiki.org/
     3 #
     4 # Copyright (C) 2000-2006 TWiki Contributors.
     5 #
     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.
    11 #
    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.
    15 #
    16 # As per the GPL, removal of this notice is prohibited.
    17 package TWiki::Configure::UIs::FINDEXTENSIONS;
    18 use base 'TWiki::Configure::UIs::Section';
    19 
    20 use strict;
    21 use TWiki::Configure::Type;
    22 
    23 sub close_html {
    24     my ($this, $section) = @_;
    25 
    26     my $button = <<HERE;
    27 Consult online extensions repositories for
    28 new extensions. <b>If you made any changes, save them first!<b>
    29 HERE
    30     # Check that the extensions UI is loadable
    31     my $bad = 0;
    32     foreach my $module qw(TWiki::Configure::UIs::EXTEND TWiki::Configure::UIs::FINDEXTENSIONS) {
    33         eval "require $module";
    34         if ($@) {
    35             $bad = 1;
    36             last;
    37         }
    38     }
    39     my $actor;
    40     if (!$bad) {
    41         # Can't use a submit here, because if we do, it is invoked when
    42         # the user presses Enter in a text field.
    43         my @script = File::Spec->splitdir($ENV{SCRIPT_NAME} || 'THISSCRIPT');
    44         my $scriptName = pop(@script);
    45         $scriptName =~ s/.*[\/\\]//;  # Fix for Item3511, on Win XP
    46 
    47         $actor = CGI::a({ href => $scriptName.'?action=FindMoreExtensions',
    48                           class=>'twikiSubmit',
    49                           accesskey => 'P' },
    50                         'Find More Extensions');
    51     } else {
    52         $actor = $this->WARN(<<MESSAGE);
    53 Cannot load the extensions installer.
    54 Check 'Perl Modules' in the 'CGI Setup' section above, and install any
    55 missing modules required for the Extensions Installer.
    56 MESSAGE
    57     }
    58     return CGI::Tr(CGI::td($button),CGI::td($actor)).
    59       $this->SUPER::close_html($section);
    60 }
    61 
    62 1;