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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt (+2 lines)
Lines 77-82 Link Here
77
                                    <th>Name</th>
77
                                    <th>Name</th>
78
                                    <th>Description</th>
78
                                    <th>Description</th>
79
                                    <th>Organization</th>
79
                                    <th>Organization</th>
80
                                    <th>Latest version</th>
80
                                    <th>&nbsp;</th>
81
                                    <th>&nbsp;</th>
81
                                </tr>
82
                                </tr>
82
                            </thead>
83
                            </thead>
Lines 86-91 Link Here
86
                                    <td><a href="[% sr.result.html_url | url %]" target="_new">[% sr.result.name | html %]</a></td>
87
                                    <td><a href="[% sr.result.html_url | url %]" target="_new">[% sr.result.name | html %]</a></td>
87
                                    <td>[% sr.result.description | html %]</td>
88
                                    <td>[% sr.result.description | html %]</td>
88
                                    <td>[% sr.repo.name | html %]</td>
89
                                    <td>[% sr.repo.name | html %]</td>
90
                                    <td>[% sr.result.tag_name | html %]</td>
89
                                    <td><a class="btn btn-default btn-sm btn-install-plugin" href="/cgi-bin/koha/plugins/plugins-upload.pl?op=Upload&uploadfile=[% sr.result.install_name | uri %]&uploadlocation=[% sr.result.install_url | uri %]"><i class="fa fa-download"></i> Install</a></td>
91
                                    <td><a class="btn btn-default btn-sm btn-install-plugin" href="/cgi-bin/koha/plugins/plugins-upload.pl?op=Upload&uploadfile=[% sr.result.install_name | uri %]&uploadlocation=[% sr.result.install_url | uri %]"><i class="fa fa-download"></i> Install</a></td>
90
                                </tr>
92
                                </tr>
91
                            [% END %]
93
                            [% END %]
(-)a/plugins/plugins-home.pl (-8 / +12 lines)
Lines 77-87 if ($plugins_enabled) { Link Here
77
                foreach my $result ( @{ $response->{items} } ) {
77
                foreach my $result ( @{ $response->{items} } ) {
78
                    next unless $result->{name} =~ /^koha-plugin-/;
78
                    next unless $result->{name} =~ /^koha-plugin-/;
79
                    my $releases = $result->{url} . "/releases/latest";
79
                    my $releases = $result->{url} . "/releases/latest";
80
                    my $release = from_json( get($releases) );
80
                    my $release  = from_json( get($releases) );
81
                    my $tag_name = $release->{tag_name};
81
                    for my $asset ( @{$release->{assets}} ) {
82
                    for my $asset ( @{$release->{assets}} ) {
82
                        if ($asset->{browser_download_url} =~ m/\.kpz$/) {
83
                        if ($asset->{browser_download_url} =~ m/\.kpz$/) {
83
                            $result->{install_name} = $asset->{name};
84
                            $result->{install_name} = $asset->{name};
84
                            $result->{install_url} = $asset->{browser_download_url};
85
                            $result->{install_url}  = $asset->{browser_download_url};
86
                            $result->{tag_name}     = $tag_name;
85
                        }
87
                        }
86
                    }
88
                    }
87
                    push( @results, { repo => $r, result => $result } );
89
                    push( @results, { repo => $r, result => $result } );
Lines 100-111 if ($plugins_enabled) { Link Here
100
                    my @releases     = @{ from_json( get($releases_url) ) };
102
                    my @releases     = @{ from_json( get($releases_url) ) };
101
103
102
                    if ( scalar @releases > 0 ) {
104
                    if ( scalar @releases > 0 ) {
105
103
                        # Pick the first one, the latest release
106
                        # Pick the first one, the latest release
104
                        my $latest = $releases[0];
107
                        my $latest   = $releases[0];
105
                        my $name  = $latest->{name};
108
                        my $name     = $latest->{name};
106
                        my @links = @{$latest->{assets}->{links}};
109
                        my $tag_name = $latest->{tag_name};
107
                        my $url   = $links[0]->{direct_asset_url};
110
                        my @links    = @{ $latest->{assets}->{links} };
108
                        my @parts = split( '/', $url);
111
                        my $url      = $links[0]->{direct_asset_url};
112
                        my @parts    = split( '/', $url );
109
                        my $filename = $parts[-1];
113
                        my $filename = $parts[-1];
110
                        next unless $url =~ m/\.kpz$/;
114
                        next unless $url =~ m/\.kpz$/;
111
                        my $result = {
115
                        my $result = {
Lines 114-119 if ($plugins_enabled) { Link Here
114
                            install_url  => $url,
118
                            install_url  => $url,
115
                            html_url     => $web_url,
119
                            html_url     => $web_url,
116
                            name         => $name,
120
                            name         => $name,
121
                            tag_name     => $tag_name,
117
                        };
122
                        };
118
                        push @results, { repo => $r, result => $result };
123
                        push @results, { repo => $r, result => $result };
119
                    }
124
                    }
120
- 

Return to bug 29787