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

(-)a/Koha/Subscription/Frequency.pm (-4 lines)
Lines 25-35 use base qw(Koha::Object); Link Here
25
25
26
=head1 NAME
26
=head1 NAME
27
27
28
<<<<<<< b4c9007cc708d995838eae801a5a24b47435095e
29
Koha::Subscription::Frequency - Koha Subscription Frequency Object class
30
=======
31
Koha::Subscription::Frequency - Koha Subscription::Frequency Object class
28
Koha::Subscription::Frequency - Koha Subscription::Frequency Object class
32
>>>>>>> Bug 17047 subscriptions management with Mana-KB
33
29
34
=head1 API
30
=head1 API
35
31
(-)a/admin/admin-home.pl (+2 lines)
Lines 25-30 use Koha::Plugins; Link Here
25
my $query = new CGI;
25
my $query = new CGI;
26
26
27
my $plugins_enabled = C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins");
27
my $plugins_enabled = C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins");
28
my $mana_url        = C4::Context->config('mana_config');
28
29
29
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
30
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
30
    {
31
    {
Lines 38-42 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
38
);
39
);
39
40
40
$template->param( plugins_enabled => $plugins_enabled, );
41
$template->param( plugins_enabled => $plugins_enabled, );
42
$template->param( mana_url        => $mana_url, );
41
43
42
output_html_with_http_headers $query, $cookie, $template->output;
44
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/admin/share_content.pl (+89 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
use JSON;
22
use HTTP::Request;
23
24
use C4::Auth;
25
use C4::Output;
26
27
use Koha::SharedContent;
28
29
my $query = new CGI;
30
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
31
    {
32
        template_name   => "admin/share_content.tt",
33
        query           => $query,
34
        type            => "intranet",
35
        authnotrequired => 0,
36
        flagsrequired   => { parameters => '*' },
37
        debug           => 1,
38
    }
39
);
40
41
my $op = $query->param('op') || q||;
42
43
if ( $op eq 'save' ) {
44
    my $auto_share = $query->param('autosharewithmana');
45
    my $mana = $query->param('mana');
46
47
    C4::Context->set_preference('Mana', $mana);
48
49
    if ( $auto_share ne '' ) {
50
        C4::Context->set_preference('AutoShareWithMana', 'subscription');
51
    } else {
52
        C4::Context->set_preference('AutoShareWithMana', '');
53
    }
54
}
55
56
if ( $op eq 'reset' ) {
57
    C4::Context->set_preference('ManaToken', '');
58
}
59
60
if ( $op eq 'send' ) {
61
    my $name = $query->param('lastname');
62
    my $firstname = $query->param('firstname');
63
    my $email = $query->param('email');
64
65
    my $content = to_json({firstname => $firstname,
66
                           lastname => $name,
67
                           email => $email});
68
69
    my $mana_ip = C4::Context->config('mana_config');
70
    my $url = "$mana_ip/getsecuritytoken";
71
    my $request = HTTP::Request->new( POST => $url );
72
    $request->content($content);
73
    my $result = Koha::SharedContent::process_request($request);
74
75
    $template->param( result => $result );
76
77
    if ( $result->{code} eq '201' && $result->{token} ) {
78
        C4::Context->set_preference('ManaToken', $result->{token});
79
    }
80
}
81
82
83
my $mana_url = C4::Context->config('mana_config') || '';
84
85
$template->param(
86
    mana_url    => $mana_url,
87
);
88
89
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/installer/data/mysql/atomicupdate/mana_02-add_Mana_syspref.sql (-1 / +2 lines)
Line 1 Link Here
1
INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('Mana','2', 0|1|2,'request to Mana Webservice. Mana centralize commun information between other Koha to facilitate the creation of new subscriptions, vendors, report queries etc... You can search, share, import and comment the content of Mana.','Choice');
1
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
2
('Mana','1',NULL,'request to Mana Webservice. Mana centralize common information between other Koha to facilitate the creation of new subscriptions, vendors, report queries etc... You can search, share, import and comment the content of Mana.','YesNo');
(-)a/installer/data/mysql/sysprefs.sql (-1 / +1 lines)
Lines 275-281 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
275
('LocalHoldsPriorityItemControl',  'holdingbranch',  'holdingbranch|homebranch',  'decides if the feature operates using the item''s home or holding library.',  'Choice'),
275
('LocalHoldsPriorityItemControl',  'holdingbranch',  'holdingbranch|homebranch',  'decides if the feature operates using the item''s home or holding library.',  'Choice'),
276
('LocalHoldsPriorityPatronControl',  'PickupLibrary',  'HomeLibrary|PickupLibrary',  'decides if the feature operates using the library set as the patron''s home library, or the library set as the pickup library for the given hold.',  'Choice'),
276
('LocalHoldsPriorityPatronControl',  'PickupLibrary',  'HomeLibrary|PickupLibrary',  'decides if the feature operates using the library set as the patron''s home library, or the library set as the pickup library for the given hold.',  'Choice'),
277
('makePreviousSerialAvailable','0','','make previous serial automatically available when collecting a new serial. Please note that the item-level_itypes syspref must be set to specific item.','YesNo'),
277
('makePreviousSerialAvailable','0','','make previous serial automatically available when collecting a new serial. Please note that the item-level_itypes syspref must be set to specific item.','YesNo'),
278
('Mana','1',NULL,'request to Mana Webservice. Mana centralize commun information between other Koha to facilitate the creation of new subscriptions, vendors, report queries etc... You can search, share, import and comment the content of Mana.','YesNo'),
278
('Mana','1',NULL,'request to Mana Webservice. Mana centralize common information between other Koha to facilitate the creation of new subscriptions, vendors, report queries etc... You can search, share, import and comment the content of Mana.','YesNo'),
279
('ManInvInNoissuesCharge','1',NULL,'MANUAL_INV charges block checkouts (added to noissuescharge).','YesNo'),
279
('ManInvInNoissuesCharge','1',NULL,'MANUAL_INV charges block checkouts (added to noissuescharge).','YesNo'),
280
('MARCAuthorityControlField008','|| aca||aabn           | a|a     d',NULL,'Define the contents of MARC21 authority control field 008 position 06-39','Textarea'),
280
('MARCAuthorityControlField008','|| aca||aabn           | a|a     d',NULL,'Define the contents of MARC21 authority control field 008 position 06-39','Textarea'),
281
('MarcFieldDocURL', NULL, NULL, 'URL used for MARC field documentation. Following substitutions are available: {MARC} = marc flavour, eg. "MARC21" or "UNIMARC". {FIELD} = field number, eg. "000" or "048". {LANG} = user language, eg. "en" or "fi-FI"', 'free'),
281
('MarcFieldDocURL', NULL, NULL, 'URL used for MARC field documentation. Following substitutions are available: {MARC} = marc flavour, eg. "MARC21" or "UNIMARC". {FIELD} = field number, eg. "000" or "048". {LANG} = user language, eg. "en" or "fi-FI"', 'free'),
(-)a/koha-tmpl/intranet-tmpl/lib/jquery/activatemana.js (-18 lines)
Lines 1-18 Link Here
1
$(document).ready(function(){
2
    $("#activatemana").on("click", function(){
3
        var mylastname = $("#lastname").val()
4
        var myfirstname = $("#firstname").val()
5
        var myemail = $("#email").val()
6
        $.ajax( {
7
            type: "POST",
8
            url: "/cgi-bin/koha/svc/mana/token",
9
            data: { lastname: mylastname, firstname: myfirstname, email: myemail},
10
            dataType: "json",
11
        })
12
        .done(function(result){
13
            $("#pref_ManaToken").val(result.token);
14
            $("#pref_ManaToken").trigger("input");
15
        });
16
        return false;
17
    });
18
});
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-report-search-result.inc (-14 / +15 lines)
Lines 2-7 Link Here
2
[% USE Koha %]
2
[% USE Koha %]
3
[% USE AuthorisedValues %]
3
[% USE AuthorisedValues %]
4
[% USE Branches %]
4
[% USE Branches %]
5
[% USE raw %]
5
6
6
<script type="text/javascript">
7
<script type="text/javascript">
7
//<![CDATA[
8
//<![CDATA[
Lines 45-74 $(document).ready(function() { Link Here
45
            [% FOREACH report IN reports %]
46
            [% FOREACH report IN reports %]
46
                [% UNLESS report.cannotdisplay %]
47
                [% UNLESS report.cannotdisplay %]
47
                    [% IF report.nbofcomment > highWarned %]
48
                    [% IF report.nbofcomment > highWarned %]
48
                  <tr id="row[% report.id %]" class = "high-warned-row">
49
                  <tr id="row[% report.id | $raw %]" class = "high-warned-row">
49
                    [% ELSIF report.nbofcomment > warned %]
50
                    [% ELSIF report.nbofcomment > warned %]
50
                  <tr id="row[% report.id %]" class = "warned-row">
51
                  <tr id="row[% report.id | $raw %]" class = "warned-row">
51
                    [% ELSIF report.nbofcomment > lowWarned %]
52
                    [% ELSIF report.nbofcomment > lowWarned %]
52
                  <tr id="row[% report.id %]" class = "highlighted-row">
53
                  <tr id="row[% report.id | $raw %]" class = "highlighted-row">
53
                    [% END %]
54
                    [% END %]
54
                    <input hidden class="rowid" value="[% report.id %]">
55
                    <input hidden class="rowid" value="[% report.id | $raw %]">
55
                    <td>[% IF ( report.report_name ) %][% report.report_name %][% END %]</td>
56
                    <td>[% IF ( report.report_name ) %][% report.report_name | html %][% END %]</td>
56
                    <td title="[% report.savedsql |html %]"><div>
57
                    <td title="[% report.savedsql | html %]"><div>
57
                        [% IF report.notes.length > 200 %]
58
                        [% IF report.notes.length > 200 %]
58
                            [% report.notes.substr(0,200) %]<a class="showbutton">Show More</a></div><div hidden>
59
                            [% report.notes.substr(0,200) | html %]<a class="showbutton">Show More</a></div><div hidden>
59
                        [% END %]
60
                        [% END %]
60
                            [% report.notes %]
61
                            [% report.notes | html %]
61
                        [% IF report.notes.length > 200 %]
62
                        [% IF report.notes.length > 200 %]
62
                                <a class="hidebutton">Show Less</a></div> </td>
63
                                <a class="hidebutton">Show Less</a></div> </td>
63
                        [% END %]
64
                        [% END %]
64
                    <td> [% report.type %] </td>
65
                    <td> [% report.type | html %] </td>
65
                    <td>[% IF ( report.nbofusers ) %][% report.nbofusers %][% END %]</td>
66
                    <td>[% IF ( report.nbofusers ) %][% report.nbofusers | $raw %][% END %]</td>
66
                    <td><span title="[% report.lastimport %]">[% report.lastimport | $KohaDates %]</span></td>
67
                    <td><span title="[% report.lastimport | $KohaDates %]">[% report.lastimport | $KohaDates %]</span></td>
67
                    <td>[% FOREACH comment IN report.comments %][% comment.message %] ([% comment.nb %]) <br>[% END %]</td>
68
                    <td>[% FOREACH comment IN report.comments %][% comment.message | html %] ([% comment.nb | $raw %]) <br>[% END %]</td>
68
69
69
                    [% UNLESS search_only %]
70
                    [% UNLESS search_only %]
70
                        <td>
71
                        <td>
71
                            <button class="mana-use" id="mana-use-[% report.id %]"><i class="fa fa-inbox"></i> Use</button>
72
                            <button class="mana-use" id="mana-use-[% report.id | $raw %]"><i class="fa fa-inbox"></i> Use</button>
72
                        </td>
73
                        </td>
73
                    [% END %]
74
                    [% END %]
74
                  </tr>
75
                  </tr>
Lines 77-81 $(document).ready(function() { Link Here
77
        </tbody>
78
        </tbody>
78
    </table>
79
    </table>
79
[% ELSE %]
80
[% ELSE %]
80
    <h4> [% msg %]  statuscode: [% statuscode %]</h4>
81
    <h4> [% msg | html %]  statuscode: [% statuscode | $raw %]</h4>
81
[% END %]
82
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-subscription-search-result.inc (-16 / +17 lines)
Lines 2-7 Link Here
2
[% USE Koha %]
2
[% USE Koha %]
3
[% USE AuthorisedValues %]
3
[% USE AuthorisedValues %]
4
[% USE Branches %]
4
[% USE Branches %]
5
[% USE raw %]
5
[% INCLUDE 'mana.inc' %]
6
[% INCLUDE 'mana.inc' %]
6
<script type="text/javascript">
7
<script type="text/javascript">
7
//<![CDATA[
8
//<![CDATA[
Lines 35-63 $(document).ready(function() { Link Here
35
            [% FOREACH subscription IN subscriptions %]
36
            [% FOREACH subscription IN subscriptions %]
36
                [% UNLESS subscription.cannotdisplay %]
37
                [% UNLESS subscription.cannotdisplay %]
37
                    [% IF subscription.nbofcomment > highWarned  %]
38
                    [% IF subscription.nbofcomment > highWarned  %]
38
                    <tr id="row[% subscription.subscriptionid %]" class = "high-warned-row" title="this resource has been reported more than [% highWarned %] times, take care!">
39
                    <tr id="row[% subscription.subscriptionid | $raw %]" class = "high-warned-row" title="this resource has been reported more than [% highWarned | html %] times, take care!">
39
                    [% ELSIF subscription.nbofcomment > warned  %]
40
                    [% ELSIF subscription.nbofcomment > warned  %]
40
                    <tr id="row[% subscription.subscriptionid %]" class = "warned-row" title="this resource has been reported more than [% warned %] times, take care!">
41
                    <tr id="row[% subscription.subscriptionid | $raw %]" class = "warned-row" title="this resource has been reported more than [% warned | html %] times, take care!">
41
                    [% ELSIF subscription.nbofcomment > lowWarned  %]
42
                    [% ELSIF subscription.nbofcomment > lowWarned  %]
42
                    <tr id="row[% subscription.subscriptionid %]" class = "highlighted-row" title="this resource has been reported more than [% lowWarned %] times, take care!">
43
                    <tr id="row[% subscription.subscriptionid | $raw %]" class = "highlighted-row" title="this resource has been reported more than [% lowWarned | html %] times, take care!">
43
                    [% END %]
44
                    [% END %]
44
                    <input hidden class="rowid" value="[% subscription.id %]">
45
                    <input hidden class="rowid" value="[% subscription.id | $raw %]">
45
                        <td>[% IF ( subscription.issn ) %][% subscription.issn %][% END %]</td>
46
                        <td>[% IF ( subscription.issn ) %][% subscription.issn | html %][% END %]</td>
46
                        <td>[% subscription.title %]</a></td>
47
                        <td>[% subscription.title | html %]</a></td>
47
                        <td>[% IF ( subscription.publishercode ) %][% subscription.publishercode %][% END %]</td>
48
                        <td>[% IF ( subscription.publishercode ) %][% subscription.publishercode | html %][% END %]</td>
48
                        <td>[% IF ( subscription.sfdescription ) %][% subscription.sfdescription %][% END %]</td>
49
                        <td>[% IF ( subscription.sfdescription ) %][% subscription.sfdescription | html %][% END %]</td>
49
                        <td>[% IF ( subscription.numberingmethod ) %][% subscription.numberingmethod %][% END %]</td>
50
                        <td>[% IF ( subscription.numberingmethod ) %][% subscription.numberingmethod | html %][% END %]</td>
50
                        <td>[% IF ( subscription.nbofusers ) %][% subscription.nbofusers %][% END %]</td>
51
                        <td>[% IF ( subscription.nbofusers ) %][% subscription.nbofusers | $raw %][% END %]</td>
51
                        <td><span title="[% subscription.lastimport %]">[% subscription.lastimport | $KohaDates %]</span></td>
52
                        <td><span title="[% subscription.lastimport | $KohaDates %]">[% subscription.lastimport | $KohaDates %]</span></td>
52
                        <td>[% FOREACH comment IN subscription.comments %][% comment.message %] ([% comment.nb %]) <br>[% END %]</td>
53
                        <td>[% FOREACH comment IN subscription.comments %][% comment.message | html %] ([% comment.nb | $raw %]) <br>[% END %]</td>
53
54
54
                        [% UNLESS search_only %]
55
                        [% UNLESS search_only %]
55
                            <td>
56
                            <td>
56
                                <button class="mana-use" id="mana-use-[% subscription.id %]"><i class="fa fa-inbox"></i> Use</button>
57
                                <button class="mana-use" id="mana-use-[% subscription.id | $raw %]"><i class="fa fa-inbox"></i> Use</button>
57
                                <select class="mana-actions" id="mana-actions-[% subscription.id %]">
58
                                <select class="mana-actions" id="mana-actions-[% subscription.id | $raw %]">
58
                                    <option selected disabled>Report mistake</option>
59
                                    <option selected disabled>Report mistake</option>
59
                                    [% FOREACH comment IN subscription.comments %]
60
                                    [% FOREACH comment IN subscription.comments %]
60
                                        <option value="[% comment.id %]"> [% comment.message %] ([% comment.nb %])</option>
61
                                        <option value="[% comment.id | $raw %]"> [% comment.message | html %] ([% comment.nb | $raw %])</option>
61
                                    [% END %]
62
                                    [% END %]
62
                                        <option>other</option>
63
                                        <option>other</option>
63
                                </select>
64
                                </select>
Lines 70-76 $(document).ready(function() { Link Here
70
        </tbody>
71
        </tbody>
71
    </table>
72
    </table>
72
[% ELSE %]
73
[% ELSE %]
73
    <h4>Mana search fails with the code: [% statuscode %] </h4>
74
    <h4>Mana search fails with the code: [% statuscode | html %] </h4>
74
[% END %]
75
[% END %]
75
76
76
<div id="comment_box" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="display: none;">
77
<div id="comment_box" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="display: none;">
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc (-9 / +15 lines)
Lines 55-62 Link Here
55
                <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"> Report mistake <span class="caret"></span></button>
55
                <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"> Report mistake <span class="caret"></span></button>
56
                <ul class="dropdown-menu">
56
                <ul class="dropdown-menu">
57
                    [% FOREACH c IN mana_comments %]
57
                    [% FOREACH c IN mana_comments %]
58
                        <li class="mana-comment" data-id="[% c.id %]">
58
                        <li class="mana-comment" data-id="[% c.id | $raw %]">
59
                            <a href="#">[% c.message %] ([% c.nb %])</a>
59
                            <a href="#">[% c.message | html %] ([% c.nb | html %])</a>
60
                        </li>
60
                        </li>
61
                    [% END %]
61
                    [% END %]
62
                    <li role="separator" class="divider"></li>
62
                    <li role="separator" class="divider"></li>
Lines 73-79 Link Here
73
                        </div>
73
                        </div>
74
                        <div class="modal-body">
74
                        <div class="modal-body">
75
                            <input hidden id="mana-resource" value="report">
75
                            <input hidden id="mana-resource" value="report">
76
                            <input hidden id="mana-resource-id" value="[% mana_id %]">
76
                            <input hidden id="mana-resource-id" value="[% mana_id | $raw %]">
77
                            <div>
77
                            <div>
78
                                <input type="text" maxlength="35" size="35" id="mana-comment">
78
                                <input type="text" maxlength="35" size="35" id="mana-comment">
79
                            </div>
79
                            </div>
Lines 124-135 Link Here
124
                    <h3 id="mana_search_result_label"> Mana Search</h3>
124
                    <h3 id="mana_search_result_label"> Mana Search</h3>
125
                </div>
125
                </div>
126
                <div>
126
                <div>
127
                    <form id="search_form" style="margin-left: 5%">
128
                        Please enter a few key words:
129
                        <input type=text id=mana_search_field>
130
                        <input type=button class="mana_search_button" value="Search">
131
                    </form>
132
                    <div class="modal-body">
127
                    <div class="modal-body">
128
                        <fieldset>
129
                            <form id="mana_search_form" style="margin-left: 5%">
130
                                Please enter a few key words:
131
                                <input type="text" id="mana_search_field">
132
                                <input type="submit" class="mana_search_button" value="Search">
133
                            </form>
134
                        </fieldset>
135
                        <div class="mana_result_content">
136
                        </div>
133
                    </div>
137
                    </div>
134
                </div>
138
                </div>
135
            </div>
139
            </div>
Lines 158-163 Link Here
158
    }
162
    }
159
163
160
    function mana_search( textquery ){
164
    function mana_search( textquery ){
165
        $(document.body).css({'cursor' : 'wait'});
161
        $.ajax({
166
        $.ajax({
162
            type: "POST",
167
            type: "POST",
163
            url: "/cgi-bin/koha/svc/mana/search",
168
            url: "/cgi-bin/koha/svc/mana/search",
Lines 165-171 Link Here
165
            dataType: "html",
170
            dataType: "html",
166
        })
171
        })
167
        .done( function( result ) {
172
        .done( function( result ) {
168
            $("#mana_search_result .modal-body").html(result);
173
            $(document.body).css({'cursor' : 'default'});
174
            $("#mana_search_result .modal-body .mana_result_content").html(result);
169
            $("#mana_search_result_label").text(_("Results from Mana Knowledge Base"));
175
            $("#mana_search_result_label").text(_("Results from Mana Knowledge Base"));
170
            $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults,{
176
            $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults,{
171
                "sPaginationType":"four_button",
177
                "sPaginationType":"four_button",
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-menu.inc (-1 / +1 lines)
Lines 31-37 Link Here
31
        </a>
31
        </a>
32
    </li>
32
    </li>
33
    <li><a href="/cgi-bin/koha/serials/add_fields.pl">Add subscription fields</a></li>
33
    <li><a href="/cgi-bin/koha/serials/add_fields.pl">Add subscription fields</a></li>
34
    [% IF Koha.Preference('Mana') %]
34
    [% IF Koha.Preference('Mana') == 1 %]
35
        <li><a href="/cgi-bin/koha/serials/serials-search.pl?mana=1">Search on Mana</a></li>
35
        <li><a href="/cgi-bin/koha/serials/serials-search.pl?mana=1">Search on Mana</a></li>
36
    [% END %]
36
    [% END %]
37
</ul>
37
</ul>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc (-27 / +27 lines)
Lines 7-13 Link Here
7
            [% ELSE %]
7
            [% ELSE %]
8
                <div class="btn-group"><a id="newsubscription" class="btn btn-default btn-sm" href="/cgi-bin/koha/serials/subscription-add.pl"><i class="fa fa-plus"></i> New subscription</a></div>
8
                <div class="btn-group"><a id="newsubscription" class="btn btn-default btn-sm" href="/cgi-bin/koha/serials/subscription-add.pl"><i class="fa fa-plus"></i> New subscription</a></div>
9
            [% END %]
9
            [% END %]
10
            [% IF Koha.Preference('Mana') and Koha.Preference('AutoShareWithMana').grep('subscription').size == 0 %]
10
            [% IF Koha.Preference('Mana') == 1 and Koha.Preference('AutoShareWithMana').grep('subscription').size == 0 %]
11
                [% IF one_language_enabled==0 or mana_id %]
11
                [% IF one_language_enabled==0 or mana_id %]
12
                    <div class="btn-group"><a data-toggle="modal" data-toggle="tooltip" title="Share the subscription with other librairies. Your email address will be associated to your sharing." data-target="#mana_share_modal" class="btn btn-default btn-sm"><i class="fa fa-share-alt"></i> Share</a></div>
12
                    <div class="btn-group"><a data-toggle="modal" data-toggle="tooltip" title="Share the subscription with other librairies. Your email address will be associated to your sharing." data-target="#mana_share_modal" class="btn btn-default btn-sm"><i class="fa fa-share-alt"></i> Share</a></div>
13
                [% ELSE %]
13
                [% ELSE %]
Lines 66-73 Link Here
66
                <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"> Report mistake <span class="caret"></span></button>
66
                <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"> Report mistake <span class="caret"></span></button>
67
                <ul class="dropdown-menu">
67
                <ul class="dropdown-menu">
68
                    [% FOREACH c IN mana_comments %]
68
                    [% FOREACH c IN mana_comments %]
69
                        <li class="mana-comment" data-id="[% c.id %]">
69
                        <li class="mana-comment" data-id="[% c.id | $raw %]">
70
                            <a href="#">[% c.message %] ([% c.nb %])</a>
70
                            <a href="#">[% c.message | html %] ([% c.nb | html %])</a>
71
                        </li>
71
                        </li>
72
                    [% END %]
72
                    [% END %]
73
                    <li role="separator" class="divider"></li>
73
                    <li role="separator" class="divider"></li>
Lines 84-90 Link Here
84
                        </div>
84
                        </div>
85
                        <div class="modal-body">
85
                        <div class="modal-body">
86
                            <input hidden id="mana-resource" value="subscription">
86
                            <input hidden id="mana-resource" value="subscription">
87
                            <input hidden id="mana-resource-id" value="[% mana_id %]">
87
                            <input hidden id="mana-resource-id" value="[% mana_id | $raw %]">
88
                            <div>
88
                            <div>
89
                                <input type="text" maxlength="35" size="35" id="mana-comment">
89
                                <input type="text" maxlength="35" size="35" id="mana-comment">
90
                            </div>
90
                            </div>
Lines 109-120 Link Here
109
    <div class="modal-dialog">
109
    <div class="modal-dialog">
110
        <div class="modal-content">
110
        <div class="modal-content">
111
            <div class="modal-header">
111
            <div class="modal-header">
112
                <h3 id="mana_share_modal_label">Share [% bibliotitle %] to Mana</h3>
112
                <h3 id="mana_share_modal_label">Share [% bibliotitle | html %] to Mana</h3>
113
            </div>
113
            </div>
114
            <div class="modal-body">
114
            <div class="modal-body">
115
                [% IF (mana_id) %]
115
                [% IF (mana_id) %]
116
                    <div class="alert">
116
                    <div class="alert">
117
<h1>[% (mana_id) %]</h1>
117
<h1>[% mana_id | $raw %]</h1>
118
                        <p>Your subscription is already linked with a Mana subscription model. Share it if you have made modifications, otherwise it will do nothing.</p>
118
                        <p>Your subscription is already linked with a Mana subscription model. Share it if you have made modifications, otherwise it will do nothing.</p>
119
                    </div>
119
                    </div>
120
                [% END %]
120
                [% END %]
Lines 122-131 Link Here
122
                    [% UNLESS ( one_language_enabled ) %]
122
                    [% UNLESS ( one_language_enabled ) %]
123
                        <div class="rows">
123
                        <div class="rows">
124
                                <li><span class="label">Frequency: </span>
124
                                <li><span class="label">Frequency: </span>
125
                                        [% frequency.description %]
125
                                        [% frequency.description | html %]
126
                                </li>
126
                                </li>
127
                                <li><span class="label">Number pattern: </span>
127
                                <li><span class="label">Number pattern: </span>
128
                                    [% numberpattern.label %]
128
                                    [% numberpattern.label | html %]
129
                                </li>
129
                                </li>
130
                            </ol>
130
                            </ol>
131
                        </div>
131
                        </div>
Lines 140-159 Link Here
140
                                                    [% FOREACH sublanguages_loo IN languages_loo.sublanguages_loop %]
140
                                                    [% FOREACH sublanguages_loo IN languages_loo.sublanguages_loop %]
141
                                                        [% IF ( sublanguages_loo.enabled ) %]
141
                                                        [% IF ( sublanguages_loo.enabled ) %]
142
                                                            [% IF ( sublanguages_loo.sublanguage_current ) %]
142
                                                            [% IF ( sublanguages_loo.sublanguage_current ) %]
143
                                                                <option value="[% languages_loo.rfc4646_subtag %]" selected>
143
                                                                <option value="[% languages_loo.rfc4646_subtag | html %]" selected>
144
                                                                    [% sublanguages_loo.native_description %]
144
                                                                    [% sublanguages_loo.native_description | html %]
145
                                                                    [% sublanguages_loo.script_description %]
145
                                                                    [% sublanguages_loo.script_description | html %]
146
                                                                    [% sublanguages_loo.region_description %]
146
                                                                    [% sublanguages_loo.region_description | html %]
147
                                                                    [% sublanguages_loo.variant_description %]
147
                                                                    [% sublanguages_loo.variant_description | html %]
148
                                                                    ([% sublanguages_loo.rfc4646_subtag %])
148
                                                                    ([% sublanguages_loo.rfc4646_subtag | html %])
149
                                                                </option>
149
                                                                </option>
150
                                                            [% ELSE %]
150
                                                            [% ELSE %]
151
                                                                <option value="[% languages_loo.rfc4646_subtag %]">
151
                                                                <option value="[% languages_loo.rfc4646_subtag | html %]">
152
                                                                    [% sublanguages_loo.native_description %]
152
                                                                    [% sublanguages_loo.native_description | html %]
153
                                                                    [% sublanguages_loo.script_description %]
153
                                                                    [% sublanguages_loo.script_description | html %]
154
                                                                    [% sublanguages_loo.region_description %]
154
                                                                    [% sublanguages_loo.region_description | html %]
155
                                                                    [% sublanguages_loo.variant_description %]
155
                                                                    [% sublanguages_loo.variant_description | html %]
156
                                                                    ([% sublanguages_loo.rfc4646_subtag %])
156
                                                                    ([% sublanguages_loo.rfc4646_subtag | html %])
157
                                                                </option>
157
                                                                </option>
158
                                                            [% END %]
158
                                                            [% END %]
159
                                                        [% END %]
159
                                                        [% END %]
Lines 161-179 Link Here
161
                                                [% ELSE %]
161
                                                [% ELSE %]
162
                                                    [% IF ( languages_loo.group_enabled ) %]
162
                                                    [% IF ( languages_loo.group_enabled ) %]
163
                                                        [% IF ( languages_loo.current ) %]
163
                                                        [% IF ( languages_loo.current ) %]
164
                                                            <option value="[% languages_loo.rfc4646_subtag %]" selected>
164
                                                            <option value="[% languages_loo.rfc4646_subtag | html %]" selected>
165
                                                                [% IF ( languages_loo.native_description ) %]
165
                                                                [% IF ( languages_loo.native_description ) %]
166
                                                                    [% languages_loo.native_description %]
166
                                                                    [% languages_loo.native_description | html %]
167
                                                                [% ELSE %]
167
                                                                [% ELSE %]
168
                                                                    [% languages_loo.rfc4646_subtag %]
168
                                                                    [% languages_loo.rfc4646_subtag | html %]
169
                                                                [% END %]
169
                                                                [% END %]
170
                                                            </option>
170
                                                            </option>
171
                                                        [% ELSE %]
171
                                                        [% ELSE %]
172
                                                            <option value="[% languages_loo.rfc4646_subtag %]">
172
                                                            <option value="[% languages_loo.rfc4646_subtag | html %]">
173
                                                                [% IF ( languages_loo.native_description ) %]
173
                                                                [% IF ( languages_loo.native_description ) %]
174
                                                                    [% languages_loo.native_description %]
174
                                                                    [% languages_loo.native_description | html %]
175
                                                                [% ELSE %]
175
                                                                [% ELSE %]
176
                                                                    [% languages_loo.rfc4646_subtag %]
176
                                                                    [% languages_loo.rfc4646_subtag | html %]
177
                                                                [% END %]
177
                                                                [% END %]
178
                                                            </option>
178
                                                            </option>
179
                                                        [% END %]
179
                                                        [% END %]
Lines 183-189 Link Here
183
                                        [% END %]
183
                                        [% END %]
184
                                    </select>
184
                                    </select>
185
                                    <input type="hidden" id="op" name="op" value="share"/>
185
                                    <input type="hidden" id="op" name="op" value="share"/>
186
                                    <input type="hidden" id="subscriptionid" name="subscriptionid" value="[% subscriptionid %]"/>
186
                                    <input type="hidden" id="subscriptionid" name="subscriptionid" value="[% subscriptionid | $raw %]"/>
187
                                </fieldset>
187
                                </fieldset>
188
                            </form>
188
                            </form>
189
                        </div>
189
                        </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt (-5 / +13 lines)
Lines 13-23 Link Here
13
<div class="main container-fluid">
13
<div class="main container-fluid">
14
    <div class="row">
14
    <div class="row">
15
        <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
15
        <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
16
            [% IF ( Koha.Preference('Mana') == 2) %]
16
            [% IF ( Koha.Preference('Mana') == 1) && !mana_url %]
17
                <fieldset>
17
                <div class="dialog message">
18
                    <p><center> You haven't decided if you want to activate Mana Knowlede Base, please let us know by clicking<center></p>
18
                    <p><center>The Mana Knowledge Base feature is enabled but not configured.</center></p>
19
                    <a href=/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=request+to+mana+webservice><center>Here</center></a>
19
                    <p>This feature allows you to retrieve and share data (subscription patterns and reports) with other Koha libaries.</p>
20
                </fieldset>
20
                    <p>
21
                        Ask your system administrator to configure this feature, or remove this note by disabling the 'Mana' system preference
22
                        <a href=/cgi-bin/koha/admin/share_content.pl>here.</a>
23
                    </p>
24
                </div>
21
           [% END %]
25
           [% END %]
22
        <h1>Koha administration</h1>
26
        <h1>Koha administration</h1>
23
        <div class="row">
27
        <div class="row">
Lines 192-197 Link Here
192
                        <dt><a href="/cgi-bin/koha/admin/usage_statistics.pl">Share your usage statistics</a></dt>
196
                        <dt><a href="/cgi-bin/koha/admin/usage_statistics.pl">Share your usage statistics</a></dt>
193
                        <dd>Share with the Koha community the usage statistics of your Koha installation.</dd>
197
                        <dd>Share with the Koha community the usage statistics of your Koha installation.</dd>
194
                    [% END %]
198
                    [% END %]
199
                    [% IF ( CAN_user_parameters ) %]
200
                        <dt><a href="/cgi-bin/koha/admin/share_content.pl">Using Mana-KB</a></dt>
201
                        <dd>Share content (subscriptions, reports) with Koha communty</dd>
202
                    [% END %]
195
                </dl>
203
                </dl>
196
            [% END %]
204
            [% END %]
197
            </div>
205
            </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt (-1 lines)
Lines 197-203 Link Here
197
    [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
197
    [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
198
    [% Asset.js("js/ajax.js") | $raw %]
198
    [% Asset.js("js/ajax.js") | $raw %]
199
    [% Asset.js("js/pages/preferences.js") | $raw %]
199
    [% Asset.js("js/pages/preferences.js") | $raw %]
200
    [% Asset.js("lib/jquery/activatemana.js") | $raw %]
201
    [%# Add WYSIWYG editor for htmlarea system preferences %]
200
    [%# Add WYSIWYG editor for htmlarea system preferences %]
202
    [% INCLUDE 'wysiwyg-systempreferences.inc' %]
201
    [% INCLUDE 'wysiwyg-systempreferences.inc' %]
203
[% END %]
202
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref (-4 / +2 lines)
Lines 63-77 Web services: Link Here
63
        -
63
        -
64
            - pref: Mana
64
            - pref: Mana
65
              choices:
65
              choices:
66
                  0: Disable
66
                yes: Enable
67
                  1: Enable
67
                no: Disable
68
                  2: No, let me think about it
69
            - request to Mana Webservice. Mana centralize commun information between other Koha to facilitate the creation of new subscriptions, vendors, report queries etc... You can search, share, import and comment the content of Mana. The informations shared with Mana KB are shared under the CC-0 license. More infos about CC-0 license on https://creativecommons.org/choose/zero/
68
            - request to Mana Webservice. Mana centralize commun information between other Koha to facilitate the creation of new subscriptions, vendors, report queries etc... You can search, share, import and comment the content of Mana. The informations shared with Mana KB are shared under the CC-0 license. More infos about CC-0 license on https://creativecommons.org/choose/zero/
70
        -
69
        -
71
             - "Security token used to authenticate on mana:"
70
             - "Security token used to authenticate on mana:"
72
             - pref: ManaToken
71
             - pref: ManaToken
73
               class: Text
72
               class: Text
74
             - <br> You need a security token to authenticate on Mana. If this sytem preference is empty, please fill in the following form, you will receive an email to confirm and activate your token. <br> <form> First name <input name="firstname" type="text" id="firstname"> <br> Last name <input name="lastname" type=text id=lastname> <br> Email address <input name="email" type=text id=email><br> <input type=submit id=activatemana value="Send"></form>
75
        -
73
        -
76
            - 'Fields automatically shared with mana'
74
            - 'Fields automatically shared with mana'
77
            - pref: AutoShareWithMana
75
            - pref: AutoShareWithMana
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/share_content.tt (+152 lines)
Line 0 Link Here
1
[% USE raw %]
2
[% USE Asset %]
3
[% SET footerjs = 1 %]
4
[% USE Koha %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
<title>Koha &rsaquo; Administration &rsaquo; Koha usage statistics</title>
7
[% INCLUDE 'doc-head-close.inc' %]
8
</head>
9
10
<body id="admin_usage_statistics" class="admin">
11
[% INCLUDE 'header.inc' %]
12
[% INCLUDE 'cat-search.inc' %]
13
14
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; Usage statistics</div>
15
16
<div class="main container-fluid">
17
    <div class="row">
18
        <div class="col-sm-10 col-sm-push-2">
19
            <div class="col-sm-6">
20
                [% IF result.code != 201 && result.msg %]
21
                    <div class="alert alert-danger" role="alert">
22
                        [% result.msg | html %]
23
                    </div>
24
                [% END %]
25
26
                [% IF result.code == 201  %]
27
                    <div class="dialog message" role="alert">
28
Well done! You successfully created your Mana KB account. Check your mailbox and follow instructions.
29
                    </div>
30
                [% END %]
31
32
                [% UNLESS (mana_url) %]
33
                    <div class="alert alert-danger" role="alert">
34
                        Mana config is currently empty, this feature will not work. Please contact your site administartor.
35
                    </div>
36
                [% END %]
37
38
                <h1>Share content with the Koha community using Mana KB</h1>
39
                <p>Mana-kb is a global knowledge base for library-centric data. It has been designed initially to interact with Koha, the Open Source ILS, but can be used by any other software.</p>
40
41
                <p>Mana centralize commun information between other Koha to facilitate the creation of new subscriptions, vendors, report queries etc... You can search, share, import and comment the content of Mana. The informations shared with Mana KB are shared under the CC-0 license. More infos about CC-0 license <a href="https://creativecommons.org/choose/zero/">here</a>.</p>
42
43
                <p>Learn more about Mana on the <a href="https://wiki.koha-community.org/wiki/Mana_central_database">official documentation</a>.</p>
44
45
                [% IF (mana_url) %]
46
                <p> Your Mana KB server is currently: <strong>[% mana_url | url %]</strong></p>
47
                [% END %]
48
49
                <form id="mana_preference" method="post">
50
                    <fieldset class="rows">
51
                        <ol>
52
                            <li>
53
                                <label for="mana">Use Mana KB for sharing content: </label>
54
                                <select name="mana">
55
                                    [% IF Koha.Preference('Mana') == 0 %]
56
                                        <option value="0" selected="selected">No</option>
57
                                    [% ELSE %]
58
                                        <option value="0"">No</option>
59
                                    [% END %]
60
61
                                    [% IF Koha.Preference('Mana') == 1 %]
62
                                        <option value="1" selected="selected">Yes</option>
63
                                    [% ELSE %]
64
                                        <option value="1">Yes</option>
65
                                    [% END %]
66
                                </select>
67
                                <div class="hint">Enable Mana allow you to search, import and comment content from Mana server, and, to share your own.</div>
68
                            </li>
69
                            <li>
70
                                <label for="autosharewithmana">Auto subscriptions sharing: </label>
71
                                [% IF Koha.Preference('AutoShareWithMana').grep('subscription').size == 0 %]
72
                                    <input type="checkbox" name="autosharewithmana">
73
                                [% ELSE %]
74
                                    <input type="checkbox" name="autosharewithmana" checked="checked">
75
                                [% END %]
76
                                <div class="hint">If checked, new subscriptions you created yourself will be automatically shared with Mana KB.</div>
77
                            </li>
78
                            <li>
79
                                <input type="hidden" name="op" value="save">
80
                                <input type="submit" value="Save">
81
                            </li>
82
                        </ol>
83
                    </fieldset>
84
                </form>
85
86
                [% UNLESS Koha.Preference('ManaToken') %]
87
                    <h3>Configure Mana KB</h3>
88
                    <p>Once you have enabled Mana, let's start to set it up. Type your first name, last name, email address and click on send. This will send a account creation request to Mana KB that will respond back with a Mana token (a crypted id that uniquely identify your Koha). This token will automatically be saved in your database. Just after that, you will receive an email. Read it and follow the instructions.</p>
89
                [% END %]
90
91
                [% IF Koha.Preference('ManaToken') %]
92
                    <form id="mana_token" method="post">
93
                        <fieldset class="rows" id="mana_token">
94
                        <legend>Mana KB token</legend>
95
                            <ol>
96
                                <li>
97
                                    <label for="token">Mana token: </label>
98
                                    <input type="text" name="token" value="[% Koha.Preference('ManaToken') | html %]" size="50" disabled="disabled">
99
                                    <div class="hint">Your unique security token used for authentication on Mana KB service (anti spam).</div>
100
                                </li>
101
                                <li>
102
                                    <input type="hidden" name="op" value="reset">
103
                                    <input type="submit" value="Reset your token">
104
                                </li>
105
                            </ol>
106
                        </fieldset>
107
                    </form>
108
                [% ELSE %]
109
                    <form id="mana_request" method="post">
110
                        <fieldset class="rows" id="mana_subscription">
111
                            <ol>
112
                                <li>
113
                                    <label for="firstname">First name: </label>
114
                                    <input type="text" name="firstname">
115
                                </li>
116
                                <li>
117
                                    <label for="lastname">Last name: </label>
118
                                    <input type="text" name="lastname">
119
                                </li>
120
                                <li>
121
                                    <label for="email">Email: </label>
122
                                    <input type="text" name="email" size="45" required="required">
123
                                </li>
124
                                <li>
125
                                    <input type="hidden" name="op" value="send">
126
                                    <input type="submit" value="Send to Mana KB">
127
                                </li>
128
                            </ol>
129
                        </fieldset>
130
                    </form>
131
                [% END %]
132
            </div>
133
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
134
135
        <div class="col-sm-2 col-sm-pull-10">
136
            <aside>
137
                [% INCLUDE 'admin-menu.inc' %]
138
            </aside>
139
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
140
     </div> <!-- /.row -->
141
142
[% MACRO jsinclude BLOCK %]
143
    [% Asset.js("js/admin-menu.js") | $raw %]
144
    <script>
145
        $(document).ready(function() {
146
            $('#mana_token').submit(function() {
147
                return confirm("This will delete the Mana token from Koha. Do you want to continue?");
148
            });
149
        });
150
    </script>
151
[% END %]
152
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-74 / +72 lines)
Lines 137-143 canned reports and writing custom SQL reports.</p> Link Here
137
137
138
[% IF report_converted %]
138
[% IF report_converted %]
139
    <div class="dialog message">
139
    <div class="dialog message">
140
        The report "[% report_converted %]" has been converted.
140
        The report "[% report_converted | html %]" has been converted.
141
    </div>
141
    </div>
142
[% END %]
142
[% END %]
143
143
Lines 179-185 canned reports and writing custom SQL reports.</p> Link Here
179
<div style="display:inline-block">
179
<div style="display:inline-block">
180
    [% IF manamsg %]
180
    [% IF manamsg %]
181
     <div id="mana_search" class="dialog message">
181
     <div id="mana_search" class="dialog message">
182
        <p> [% manamsg %] </p>
182
        <p> [% manamsg | html %] </p>
183
    </div>
183
    </div>
184
    [% END %]
184
    [% END %]
185
185
Lines 355-439 canned reports and writing custom SQL reports.</p> Link Here
355
                <div id="note-error" class="alert alert-danger" role="alert">
355
                <div id="note-error" class="alert alert-danger" role="alert">
356
                    Please enter a report name and descriptive note before sharing (minimum 20 characters)
356
                    Please enter a report name and descriptive note before sharing (minimum 20 characters)
357
                </div>
357
                </div>
358
                [% IF ( languages_loop ) %]
358
                <div class="shared_infos rows">
359
                    [% UNLESS ( one_language_enabled ) %]
359
                    <li><span class="label">Id: </span><div id="shared_id"></div></li>
360
                        <div class="shared_infos rows">
360
                    <li><span class="label">Name: </span><div id="shared_name"></div></li>
361
                                <li> <span class="label">Id: </span><div id="shared_id"></div>
361
                    <li><span class="label">SQL: </span><div id="shared_sql"></div></li>
362
                                </li>
362
                    <li><span class="label">Group: </span><div id="shared_group"></div></li>
363
                                <li> <span class="label">Name: </span><div id="shared_name"></div>
363
                    <li><span class="label">Type: </span><div id="shared_type"></div></li>
364
                                </li>
364
                    <li><span class="label">Notes: </span><div id="shared_notes"></div></li>
365
                                <li> <span class="label">SQL: </span><div id="shared_sql"></div>
365
                </div>
366
                                </li>
366
                <div class="rows">
367
                                <li> <span class="label">Group: </span><div id="shared_group"></div>
367
                    <form method="post" id="mana_share_form" action="/cgi-bin/koha/reports/guided_reports.pl" class="validated" >
368
                                </li>
368
                        <input type="hidden" name="phase" value="Share">
369
                                <li> <span class="label">Type: </span><div id="shared_type"></div>
369
370
                                </li>
370
                        [% IF (languages_loop) %]
371
                                <li> <span class="label">Notes: </span><div id="shared_notes"></div>
371
                            <fieldset class="shared_infos">
372
                                </li>
372
                                <label for="mana_language">Language:</label>
373
373
                                <select id="mana_language" name="mana_language">
374
                        </div>
374
                                    [% FOREACH languages_loo IN languages_loop %]
375
                        <div class="rows">
375
                                        [% IF ( languages_loo.group_enabled ) %]
376
                            <form method="post" id="mana_share_form" action="/cgi-bin/koha/reports/guided_reports.pl?phase=Share" class="validated" >
376
                                            [% IF ( languages_loo.plural ) %]
377
                                <input type="hidden" name="phase" value="Share">
377
                                                [% FOREACH sublanguages_loo IN languages_loo.sublanguages_loop %]
378
378
                                                    [% IF ( sublanguages_loo.enabled ) %]
379
                                <fieldset class="shared_infos">
379
                                                        [% IF ( sublanguages_loo.sublanguage_current ) %]
380
                                    <label for="mana_language">Language:</label>
380
                                                            <option value="[% languages_loo.rfc4646_subtag | html %]" selected>
381
                                    <select id="mana_language" name="mana_language">
381
                                                                [% sublanguages_loo.native_description | html %]
382
                                        [% FOREACH languages_loo IN languages_loop %]
382
                                                                [% sublanguages_loo.script_description | html %]
383
                                            [% IF ( languages_loo.group_enabled ) %]
383
                                                                [% sublanguages_loo.region_description | html %]
384
                                                [% IF ( languages_loo.plural ) %]
384
385
                                                    [% FOREACH sublanguages_loo IN languages_loo.sublanguages_loop %]
385
                                                                [% sublanguages_loo.variant_description | html %]
386
                                                        [% IF ( sublanguages_loo.enabled ) %]
386
                                                                ([% sublanguages_loo.rfc4646_subtag | html %])
387
                                                            [% IF ( sublanguages_loo.sublanguage_current ) %]
388
                                                                <option value="[% languages_loo.rfc4646_subtag %]" selected>
389
                                                                    [% sublanguages_loo.native_description %]
390
                                                                    [% sublanguages_loo.script_description %]
391
                                                                    [% sublanguages_loo.region_description %]
392
393
                                                                    [% sublanguages_loo.variant_description %]
394
                                                                    ([% sublanguages_loo.rfc4646_subtag %])
395
                                                                </option>
396
                                                            [% ELSE %]
397
                                                                <option value="[% languages_loo.rfc4646_subtag %]">
398
                                                                    [% sublanguages_loo.native_description %]
399
                                                                    [% sublanguages_loo.script_description %]
400
                                                                    [% sublanguages_loo.region_description %]
401
                                                                    [% sublanguages_loo.variant_description %]
402
                                                                    ([% sublanguages_loo.rfc4646_subtag %])
403
                                                                </option>
404
                                                            [% END %]
405
                                                        [% END %]
406
                                                    [% END %]
407
                                                [% ELSE %]
408
                                                    [% IF ( languages_loo.group_enabled ) %]
409
                                                        [% IF ( languages_loo.current ) %]
410
                                                            <option value="[% languages_loo.rfc4646_subtag %]" selected>
411
                                                                [% IF ( languages_loo.native_description ) %]
412
                                                                    [% languages_loo.native_description %]
413
                                                                [% ELSE %]
414
                                                                    [% languages_loo.rfc4646_subtag %]
415
                                                                [% END %]
416
                                                            </option>
387
                                                            </option>
417
                                                        [% ELSE %]
388
                                                        [% ELSE %]
418
                                                            <option value="[% languages_loo.rfc4646_subtag %]">
389
                                                            <option value="[% languages_loo.rfc4646_subtag | html %]">
419
                                                                [% IF ( languages_loo.native_description ) %]
390
                                                                [% sublanguages_loo.native_description | html %]
420
                                                                    [% languages_loo.native_description %]
391
                                                                [% sublanguages_loo.script_description | html %]
421
                                                                [% ELSE %]
392
                                                                [% sublanguages_loo.region_description | html %]
422
                                                                    [% languages_loo.rfc4646_subtag %]
393
                                                                [% sublanguages_loo.variant_description | html %]
423
                                                                [% END %]
394
                                                                ([% sublanguages_loo.rfc4646_subtag | html %])
424
                                                            </option>
395
                                                            </option>
425
                                                        [% END %]
396
                                                        [% END %]
426
                                                    [% END %]
397
                                                    [% END %]
427
                                                [% END %]
398
                                                [% END %]
399
                                            [% ELSE %]
400
                                                [% IF ( languages_loo.group_enabled ) %]
401
                                                    [% IF ( languages_loo.current ) %]
402
                                                        <option value="[% languages_loo.rfc4646_subtag | html %]" selected>
403
                                                            [% IF ( languages_loo.native_description ) %]
404
                                                                [% languages_loo.native_description | html %]
405
                                                            [% ELSE %]
406
                                                                [% languages_loo.rfc4646_subtag | html %]
407
                                                            [% END %]
408
                                                        </option>
409
                                                    [% ELSE %]
410
                                                        <option value="[% languages_loo.rfc4646_subtag | html %]">
411
                                                            [% IF ( languages_loo.native_description ) %]
412
                                                                [% languages_loo.native_description | html %]
413
                                                            [% ELSE %]
414
                                                                [% languages_loo.rfc4646_subtag | html %]
415
                                                            [% END %]
416
                                                        </option>
417
                                                    [% END %]
418
                                                [% END %]
428
                                            [% END %]
419
                                            [% END %]
429
                                        [% END %]
420
                                        [% END %]
430
                                    </select>
421
                                    [% END %]
431
                                    <input type="hidden" id="reportid" name="reportid" value="[% savedreport.id %]"/>
422
                                </select>
432
                                </fieldset>
423
                            </fieldset>
433
                            </form>
424
                        [% ELSE %]
434
                        </div>
425
                            <input type="hidden" name="mana_language" value="[% lang | html %]">
435
                    [% END %]
426
                        [% END %]
436
                [% END %]
427
                        <input type="hidden" id="reportid" name="reportid"/>
428
                    </form>
429
                </div>
437
            </div>
430
            </div>
438
            <div class="modal-footer">
431
            <div class="modal-footer">
439
                <button class="btn" id="ManaCloseButton" data-dismiss="modal" aria-hidden="true">Close</button>
432
                <button class="btn" id="ManaCloseButton" data-dismiss="modal" aria-hidden="true">Close</button>
Lines 1291-1296 canned reports and writing custom SQL reports.</p> Link Here
1291
                    $("#note-error").show();
1284
                    $("#note-error").show();
1292
                }
1285
                }
1293
                else{
1286
                else{
1287
                    $("#reportid").val($(this).closest("tr").find(".report_id").text());
1294
                    $("#shared_id").html($(this).closest("tr").find(".report_id").text());
1288
                    $("#shared_id").html($(this).closest("tr").find(".report_id").text());
1295
                    $("#shared_name").html($(this).closest("tr").find(".report_name").text());
1289
                    $("#shared_name").html($(this).closest("tr").find(".report_name").text());
1296
                    $("#shared_sql").html($(this).closest("tr").find(".report_sql").val());
1290
                    $("#shared_sql").html($(this).closest("tr").find(".report_sql").val());
Lines 1496-1502 canned reports and writing custom SQL reports.</p> Link Here
1496
            });
1490
            });
1497
1491
1498
            $('div#ManaShareButton').click(function() {
1492
            $('div#ManaShareButton').click(function() {
1499
                window.location="/cgi-bin/koha/reports/guided_reports.pl?phase=Share";
1493
                $("#mana_share_form").submit();
1494
            });
1495
1496
            $("#mana_search_form").submit(function(e){
1497
                e.preventDefault();
1500
            });
1498
            });
1501
        });
1499
        });
1502
1500
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt (-1 / +1 lines)
Lines 516-522 Link Here
516
                $(".ui-datepicker-trigger").hide();
516
                $(".ui-datepicker-trigger").hide();
517
                $("label[for=location], select#location_filter").hide();
517
                $("label[for=location], select#location_filter").hide();
518
                [% FOR field IN additional_fields_for_subscription %]
518
                [% FOR field IN additional_fields_for_subscription %]
519
                      $("label[for=additional_field_[% field.id %]], input#additional_field_[% field.id %]").hide();
519
                      $("label[for=additional_field_[% field.id | $raw %]], input#additional_field_[% field.id | $raw %]").hide();
520
                [% END %]
520
                [% END %]
521
            [% END %]
521
            [% END %]
522
        });
522
        });
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (-5 / +4 lines)
Lines 214-224 width: 300px; /* not enough for IE7 apparently */ Link Here
214
214
215
                <div id="page_2">
215
                <div id="page_2">
216
                    <div class="col-md-6">
216
                    <div class="col-md-6">
217
                [% IF ( Koha.Preference('Mana') == 2) %]
217
                [% IF ( Koha.Preference('Mana') == 1) && !mana_url %]
218
                    <fieldset>
218
                    <fieldset>
219
                        <p><center>You haven't activated the Mana Knowledge Base, click
219
                        <p><center>The Mana Knowledge Base can be used to import subscription patterns submitted by other libraries and save you extra work. Ask your system administrator to configure this service and complete the configuration, or remove this message by disabling the system preference
220
                        <a href=/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=request+to+mana+webservice>here</a>
220
                        <a href=/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=request+to+mana+webservice>here</a></center></p>
221
                         to configure.</center></p>
222
                    </fieldset>
221
                    </fieldset>
223
                [% END %]
222
                [% END %]
224
223
Lines 529-535 width: 300px; /* not enough for IE7 apparently */ Link Here
529
        [% FOREACH field IN dont_export_field_loop %]
528
        [% FOREACH field IN dont_export_field_loop %]
530
            tags.push("[% field.fieldid | html %]");
529
            tags.push("[% field.fieldid | html %]");
531
        [% END %]
530
        [% END %]
532
        var mana_enabled = [% Koha.Preference('Mana') %]
531
        var mana_enabled = [% IF (Koha.Preference('Mana') && mana_url) %]1[% ELSE %]0[% END %];
533
        var MSG_LINK_TO_VENDOR = _("If you wish to claim late or missing issues you must link this subscription to a vendor. Click OK to ignore or Cancel to return and enter a vendor");
532
        var MSG_LINK_TO_VENDOR = _("If you wish to claim late or missing issues you must link this subscription to a vendor. Click OK to ignore or Cancel to return and enter a vendor");
534
        var MSG_LINK_BIBLIO = _("You must choose or create a bibliographic record");
533
        var MSG_LINK_BIBLIO = _("You must choose or create a bibliographic record");
535
        var MSG_REQUIRED_SUB_LENGTH = _("You must choose a subscription length or an end date.");
534
        var MSG_REQUIRED_SUB_LENGTH = _("You must choose a subscription length or an end date.");
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (-1 / +1 lines)
Lines 62-68 Link Here
62
    [% IF mana_code.defined %]
62
    [% IF mana_code.defined %]
63
        <div id="alert-community" class="dialog message">
63
        <div id="alert-community" class="dialog message">
64
            <p>
64
            <p>
65
                [% mana_code %]
65
                [% mana_code | html %]
66
            </p>
66
            </p>
67
        </div>
67
        </div>
68
    [% END %]
68
    [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js (-2 / +4 lines)
Lines 507-513 function mana_use(mana_id){ Link Here
507
}
507
}
508
508
509
$(document).ready(function() {
509
$(document).ready(function() {
510
    mana_search();
510
    if ( mana_enabled == 1 ) {
511
        mana_search();
512
    }
511
    $("#displayexample").hide();
513
    $("#displayexample").hide();
512
    $("#mana_search_result").modal("hide");
514
    $("#mana_search_result").modal("hide");
513
    $("#aqbooksellerid").on('keypress', function(e) {
515
    $("#aqbooksellerid").on('keypress', function(e) {
Lines 617-623 $(document).ready(function() { Link Here
617
    });
619
    });
618
    $("#subscription_add_next").on("click",function(){
620
    $("#subscription_add_next").on("click",function(){
619
        if ( Check_page1() ){
621
        if ( Check_page1() ){
620
            if ( mana_enabled ) {
622
            if ( mana_enabled == 1 ) {
621
                mana_search();
623
                mana_search();
622
            }
624
            }
623
            show_page_2();
625
            show_page_2();
(-)a/reports/guided_reports.pl (-1 / +3 lines)
Lines 678-684 elsif ( $phase eq 'Save Report' ) { Link Here
678
}
678
}
679
679
680
elsif ($phase eq 'Share'){
680
elsif ($phase eq 'Share'){
681
    my $result = Koha::SharedContent::send_entity($input->param('mana_language'), $borrowernumber, scalar $input->param('reportid'), 'report');
681
    my $lang = $input->param('mana_language') || '';
682
    my $reportid = $input->param('reportid');
683
    my $result = Koha::SharedContent::send_entity($lang, $borrowernumber, $reportid, 'report');
682
    if ( $result ) {
684
    if ( $result ) {
683
        print $input->redirect("/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&manamsg=".$result->{msg});
685
        print $input->redirect("/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&manamsg=".$result->{msg});
684
    }else{
686
    }else{
(-)a/serials/subscription-add.pl (-1 / +4 lines)
Lines 52-58 my $sub_length; Link Here
52
my $permission =
52
my $permission =
53
  ( $op eq 'modify' || $op eq 'modsubscription' ) ? "edit_subscription" : "create_subscription";
53
  ( $op eq 'modify' || $op eq 'modsubscription' ) ? "edit_subscription" : "create_subscription";
54
54
55
my ($template, $loggedinuser, $cookie)
55
our ($template, $loggedinuser, $cookie)
56
= get_template_and_user({template_name => "serials/subscription-add.tt",
56
= get_template_and_user({template_name => "serials/subscription-add.tt",
57
				query => $query,
57
				query => $query,
58
				type => "intranet",
58
				type => "intranet",
Lines 68-73 my $sub_on; Link Here
68
my $subs;
68
my $subs;
69
our $firstissuedate;
69
our $firstissuedate;
70
70
71
my $mana_url = C4::Context->config('mana_config');
72
$template->param( 'mana_url' => $mana_url );
73
71
if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') {
74
if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') {
72
75
73
    my $subscriptionid = $query->param('subscriptionid');
76
    my $subscriptionid = $query->param('subscriptionid');
(-)a/svc/mana/token (-55 lines)
Lines 1-55 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2016 BibLibre Baptiste Wojtkowski
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
#
20
21
22
use Modern::Perl;
23
24
use Koha::SharedContent;
25
use C4::Auth qw(check_cookie_auth);
26
27
use CGI;
28
use JSON;
29
30
my $input = new CGI;
31
binmode STDOUT, ":encoding(UTF-8)";
32
print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
33
34
my ( $auth_status, $sessionID ) =
35
  check_cookie_auth( $input->cookie('CGISESSID'),
36
    { serials => 'create_subscription' } );
37
38
if ( $auth_status ne "ok" ) {
39
    exit 0;
40
}
41
42
my $mana_ip = C4::Context->config('mana_config');
43
44
my $url = "$mana_ip/getsecuritytoken";
45
my $request = HTTP::Request->new( POST => $url );
46
47
my $content;
48
$content->{ firstname }= $input->param("firstname");
49
$content->{ lastname }= $input->param("lastname");
50
$content->{ email }= $input->param("email");
51
my $json = to_json( $content, { utf8 => 1 } );
52
$request->content($json);
53
my $result = Koha::SharedContent::process_request($request);
54
55
print(to_json($result));
(-)a/t/db_dependent/Koha/Subscription.t (-1 / +2 lines)
Lines 32-37 use t::lib::TestBuilder; Link Here
32
my $schema = Koha::Database->new->schema;
32
my $schema = Koha::Database->new->schema;
33
$schema->storage->txn_begin;
33
$schema->storage->txn_begin;
34
34
35
my $builder     = t::lib::TestBuilder->new;
36
35
use_ok('Koha::Subscription');
37
use_ok('Koha::Subscription');
36
38
37
subtest 'Koha::Subscription->biblio' => sub {
39
subtest 'Koha::Subscription->biblio' => sub {
38
- 

Return to bug 17047