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

(-)a/debian/templates/koha-conf-site.xml.in (+12 lines)
Lines 409-414 __END_SRU_PUBLICSERVER__ Link Here
409
      developers use it to catch bugs related to strict SQL modes -->
409
      developers use it to catch bugs related to strict SQL modes -->
410
 <dev_install>0</dev_install>
410
 <dev_install>0</dev_install>
411
 <strict_sql_modes>0</strict_sql_modes>
411
 <strict_sql_modes>0</strict_sql_modes>
412
 <plugin_repos>
413
    <repo>
414
        <name>ByWater Solutions</name>
415
        <org_name>bywatersolutions</org_name>
416
        <service>github</service>
417
    </repo>
418
    <repo>
419
        <name>Theke Solutions</name>
420
        <org_name>thekesolutions</org_name>
421
        <service>github</service>
422
    </repo>
423
 </plugin_repos>
412
424
413
</config>
425
</config>
414
</yazgfs>
426
</yazgfs>
(-)a/etc/koha-conf.xml (+12 lines)
Lines 233-238 __PAZPAR2_TOGGLE_XML_POST__ Link Here
233
      developers use it to catch bugs related to strict SQL modes -->
233
      developers use it to catch bugs related to strict SQL modes -->
234
 <dev_install>0</dev_install>
234
 <dev_install>0</dev_install>
235
 <strict_sql_modes>0</strict_sql_modes>
235
 <strict_sql_modes>0</strict_sql_modes>
236
 <plugin_repos>
237
    <repo>
238
        <name>ByWater Solutions</name>
239
        <org_name>bywatersolutions</org_name>
240
        <service>github</service>
241
    </repo>
242
    <repo>
243
        <name>Theke Solutions</name>
244
        <org_name>thekesolutions</org_name>
245
        <service>github</service>
246
    </repo>
247
 </plugin_repos>
236
248
237
</config>
249
</config>
238
</yazgfs>
250
</yazgfs>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt (+36 lines)
Lines 27-32 Link Here
27
                    [% IF ( CAN_user_plugins_manage ) %]
27
                    [% IF ( CAN_user_plugins_manage ) %]
28
                        <div class="btn-toolbar" id="toolbar">
28
                        <div class="btn-toolbar" id="toolbar">
29
                            <a href="/cgi-bin/koha/plugins/plugins-upload.pl" id="upload_plugin" class="btn btn-default"><i class="fa fa-upload"></i> Upload plugin</a>
29
                            <a href="/cgi-bin/koha/plugins/plugins-upload.pl" id="upload_plugin" class="btn btn-default"><i class="fa fa-upload"></i> Upload plugin</a>
30
30
                            <div class="btn-group">
31
                            <div class="btn-group">
31
                                <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-eye"></i> View plugins by class <span class="caret"></span></button>
32
                                <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-eye"></i> View plugins by class <span class="caret"></span></button>
32
                                <ul class="dropdown-menu">
33
                                <ul class="dropdown-menu">
Lines 38-47 Link Here
38
                                    <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=intranet_catalog_biblio_enhancements">View intranet catalog biblio enhancement plugins</a></li>
39
                                    <li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=intranet_catalog_biblio_enhancements">View intranet catalog biblio enhancement plugins</a></li>
39
                                </ul>
40
                                </ul>
40
                            </div>
41
                            </div>
42
43
                            <div class="btn-group">
44
                                <form class="form-inline">
45
                                    <div class="form-group">
46
                                        <div class="input-group">
47
                                            <input type="text" class="form-control" name="plugin-search" id="plugin-repo-search" placeholder="Search for plugins" value="[% search_term | html %]"/>
48
                                            <div class="input-group-addon"><i class="fa fa-search"></i></div>
49
                                        </div>
50
                                    </div>
51
                                </form>
52
                            </div>
41
                        </div>
53
                        </div>
42
                    [% END %]
54
                    [% END %]
43
                    <h1>Plugins</h1>
55
                    <h1>Plugins</h1>
44
56
57
                    [% IF search_results %]
58
                        <h2>Search results</h2>
59
                        <table class="table table-striped">
60
                            <thead>
61
                                <tr>
62
                                    <th>Name</th>
63
                                    <th>Description</th>
64
                                    <th>Organization</th>
65
                                    <th>&nbsp;</th>
66
                                </tr>
67
                            </thead>
68
69
                            [% FOREACH sr IN search_results %]
70
                                <tr>
71
                                    <td><a href="[% sr.result.html_url | url %]" target="_new">[% sr.result.name %]</a></td>
72
                                    <td>[% sr.result.description %]</td>
73
                                    <td>[% sr.repo.name %]</td>
74
                                    <td><button class="btn btn-install-plugin"><i class="fa fa-download"></i> Install</button></td>
75
                                </tr>
76
                            [% END %]
77
                        </table>
78
                    [% END %]
79
45
                    [% UNLESS ( plugins ) %]
80
                    [% UNLESS ( plugins ) %]
46
                        [% UNLESS ( method ) %]
81
                        [% UNLESS ( method ) %]
47
                            <div class="dialog message">No plugins installed</div>
82
                            <div class="dialog message">No plugins installed</div>
Lines 161-166 Link Here
161
    [% INCLUDE 'calendar.inc' %]
196
    [% INCLUDE 'calendar.inc' %]
162
    <script>
197
    <script>
163
        $(document).ready(function(){
198
        $(document).ready(function(){
199
            $(".btn-install-plugin").on("click", function() { alert("Sorry, this functionality doesn't exist yet!"); });
164
            $(".uninstall_plugin").on("click", function(){
200
            $(".uninstall_plugin").on("click", function(){
165
                $(".dropdown").removeClass("open");
201
                $(".dropdown").removeClass("open");
166
                var plugin_name = $(this).data("plugin-name");
202
                var plugin_name = $(this).data("plugin-name");
(-)a/plugins/plugins-home.pl (-1 / +23 lines)
Lines 21-26 use Modern::Perl; Link Here
21
21
22
use CGI qw ( -utf8 );
22
use CGI qw ( -utf8 );
23
23
24
use JSON qw(from_json);
25
use LWP::Simple qw(get);
26
24
use Koha::Plugins;
27
use Koha::Plugins;
25
use C4::Auth;
28
use C4::Auth;
26
use C4::Output;
29
use C4::Output;
Lines 31-36 my $plugins_enabled = C4::Context->preference('UseKohaPlugins') && C4::Context-> Link Here
31
34
32
my $input  = new CGI;
35
my $input  = new CGI;
33
my $method = $input->param('method');
36
my $method = $input->param('method');
37
my $plugin_search = $input->param('plugin-search');
34
38
35
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
39
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
36
    {   template_name => ($plugins_enabled) ? "plugins/plugins-home.tt" : "plugins/plugins-disabled.tt",
40
    {   template_name => ($plugins_enabled) ? "plugins/plugins-home.tt" : "plugins/plugins-disabled.tt",
Lines 56-61 if ($plugins_enabled) { Link Here
56
60
57
    $template->param( plugins => \@plugins, );
61
    $template->param( plugins => \@plugins, );
58
62
63
    my @results;
64
    if ($plugin_search) {
65
        my $repos = C4::Context->config('plugin_repos');
66
        foreach my $r ( @{ $repos->{repo} } ) {
67
            if ( $r->{service} eq 'github' ) {
68
                my $url = "https://api.github.com/search/repositories?q=$plugin_search+user:$r->{org_name}+in:name,description";
69
                my $response = from_json( get($url) );
70
                foreach my $result ( @{ $response->{items} } ) {
71
                    next unless $result->{name} =~ /^koha-plugin-/;
72
                    push( @results, { repo => $r, result => $result } );
73
                }
74
            }
75
        }
76
77
        $template->param(
78
            search_results => \@results,
79
            search_term    => $plugin_search,
80
        );
81
    }
59
}
82
}
60
83
61
output_html_with_http_headers( $input, $cookie, $template->output );
84
output_html_with_http_headers( $input, $cookie, $template->output );
62
- 

Return to bug 23975