View | Details | Raw Unified | Return to bug 22053
Collapse All | Expand All

(-)a/Koha/Plugins.pm (+10 lines)
Lines 79-84 sub GetPlugins { Link Here
79
79
80
            my $plugin = $plugin_class->new({ enable_plugins => $self->{'enable_plugins'} });
80
            my $plugin = $plugin_class->new({ enable_plugins => $self->{'enable_plugins'} });
81
81
82
            my $plugin_enabled = $plugin->retrieve_data('__ENABLED__');
83
            $plugin->{enabled} = $plugin_enabled;
84
85
            # Want all plugins. Not only enabled ones.
86
            if ( defined($params->{all}) && $params->{all} ) {
87
                $plugin_enabled = 1;
88
            }
89
90
            next unless $plugin_enabled;
91
82
            # Limit results by method or metadata
92
            # Limit results by method or metadata
83
            next if $method && !$plugin->can($method);
93
            next if $method && !$plugin->can($method);
84
            my $plugin_metadata = $plugin->get_metadata;
94
            my $plugin_metadata = $plugin->get_metadata;
(-)a/Koha/Plugins/Base.pm (-1 / +31 lines)
Lines 50-56 sub new { Link Here
50
    ## Run the installation method if it exists and hasn't been run before
50
    ## Run the installation method if it exists and hasn't been run before
51
    if ( $self->can('install') && !$self->retrieve_data('__INSTALLED__') ) {
51
    if ( $self->can('install') && !$self->retrieve_data('__INSTALLED__') ) {
52
        if ( $self->install() ) {
52
        if ( $self->install() ) {
53
            $self->store_data( { '__INSTALLED__' => 1 } );
53
            $self->store_data( { '__INSTALLED__' => 1, '__ENABLED__' => 1 } );
54
            if ( my $version = $plugin_version ) {
54
            if ( my $version = $plugin_version ) {
55
                $self->store_data({ '__INSTALLED_VERSION__' => $version });
55
                $self->store_data({ '__INSTALLED_VERSION__' => $version });
56
            }
56
            }
Lines 272-277 sub _version_compare { Link Here
272
    return 0;
272
    return 0;
273
}
273
}
274
274
275
=head2 enable
276
277
Method for enabling plugin
278
279
$plugin->enable
280
281
=cut
282
283
sub enable {
284
    my ($self) = @_;
285
286
    $self->store_data( {'__ENABLED__' => 1}  );
287
288
    return $self;
289
}
290
291
=head2 disable
292
293
Method for disabling plugin
294
295
$plugin->disable
296
297
=cut
298
299
sub disable {
300
    my ($self) = @_;
301
302
    $self->store_data( {'__ENABLED__' => 0}  );
303
}
304
275
1;
305
1;
276
__END__
306
__END__
277
307
(-)a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss (-1 / +1 lines)
Lines 520-526 input { Link Here
520
}
520
}
521
521
522
label,
522
label,
523
.label {
523
.label:not(.label-primary):not(.label-default) {
524
    color: #000;
524
    color: #000;
525
    display: inline;
525
    display: inline;
526
    font-size: inherit;
526
    font-size: inherit;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt (-1 / +13 lines)
Lines 77-83 Link Here
77
77
78
                            [% FOREACH plugin IN plugins %]
78
                            [% FOREACH plugin IN plugins %]
79
                                <tr>
79
                                <tr>
80
                                    <td><strong>[% plugin.metadata.name | html %]</strong></td>
80
                                    <td>
81
                                        [% IF ( plugin.enabled ) %]
82
                                            <span class="label label-primary">ENABLED</span>
83
                                        [% ELSE %]
84
                                            <span class="label label-default">DISABLED</span>
85
                                        [% END %]
86
                                        <strong>[% plugin.metadata.name | html %]</strong>
87
                                    </td>
81
                                    <td>
88
                                    <td>
82
                                        [% plugin.metadata.description | html %]
89
                                        [% plugin.metadata.description | html %]
83
90
Lines 124-129 Link Here
124
                                                    [% END %]
131
                                                    [% END %]
125
                                                    [% IF ( CAN_user_plugins_manage ) %]
132
                                                    [% IF ( CAN_user_plugins_manage ) %]
126
                                                            <li><a class="uninstall_plugin" data-plugin-name="[% plugin.metadata.name | html %]" href="/cgi-bin/koha/plugins/plugins-uninstall.pl?class=[% plugin.class | html %]"><i class="fa fa-trash"></i> Uninstall</a></li>
133
                                                            <li><a class="uninstall_plugin" data-plugin-name="[% plugin.metadata.name | html %]" href="/cgi-bin/koha/plugins/plugins-uninstall.pl?class=[% plugin.class | html %]"><i class="fa fa-trash"></i> Uninstall</a></li>
134
                                                        [% IF ( plugin.enabled ) %]
135
                                                                <li><a class="enable_plugin" data-plugin-name="[% plugin.metadata.name | html %]" href="/cgi-bin/koha/plugins/plugins-enable.pl?class=[% plugin.class | html %]&method=disable"><i class="fa fa-pause"></i> Disable</a></li>
136
                                                        [% ELSE %]
137
                                                                <li><a class="enable_plugin" data-plugin-name="[% plugin.metadata.name | html %]" href="/cgi-bin/koha/plugins/plugins-enable.pl?class=[% plugin.class | html %]&method=enable"><i class="fa fa-play"></i> Enable</a></li>
138
                                                        [% END %]
127
                                                    [% END %]
139
                                                    [% END %]
128
                                                </ul>
140
                                                </ul>
129
                                            </div>
141
                                            </div>
(-)a/plugins/plugins-enable.pl (+42 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
#
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use CGI qw ( -utf8 );
21
22
use C4::Context;
23
use C4::Auth qw(check_cookie_auth);
24
use Koha::Plugins::Handler;
25
26
die("Koha plugins are disabled!")
27
  unless C4::Context->preference('UseKohaPlugins');
28
29
my $input = new CGI;
30
31
my ( $auth_status, $sessionID ) =
32
  check_cookie_auth( $input->cookie('CGISESSID'), { plugins => 'manage' } );
33
34
my $class = $input->param('class');
35
my $method = $input->param('method');
36
37
Koha::Plugins::Handler->run({
38
    class => $class,
39
    method => $method
40
});
41
42
print $input->redirect("/cgi-bin/koha/plugins/plugins-home.pl");
(-)a/plugins/plugins-home.pl (-1 / +1 lines)
Lines 51-56 if ($plugins_enabled) { Link Here
51
51
52
    my @plugins = Koha::Plugins->new()->GetPlugins({
52
    my @plugins = Koha::Plugins->new()->GetPlugins({
53
        method => $method,
53
        method => $method,
54
        all    => 1,
54
    });
55
    });
55
56
56
    $template->param( plugins => \@plugins, );
57
    $template->param( plugins => \@plugins, );
57
- 

Return to bug 22053