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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/mana.inc (-44 lines)
Lines 1-44 Link Here
1
<script>
2
//<![CDATA[
3
$(document).ready(function() {
4
    function mana_increment(mana_id, resource, fieldvalue, stepvalue = 1) {
5
        $.ajax( {
6
            type: "POST",
7
            url: "/cgi-bin/koha/svc/mana/increment",
8
            data: {id: mana_id, resource: resource, field: fieldvalue, step: stepvalue},
9
            datatype: "json",
10
        })
11
    }
12
13
    function mana_comment( target_id, manamsg, resource_type ) {
14
        $.ajax( {
15
            type: "POST",
16
            url: "/cgi-bin/koha/svc/mana/share",
17
            data: {message: manamsg, resource: resource_type , resource_id: target_id},
18
            datatype: "json",
19
        })
20
    }
21
22
    $(document).on('click', 'ul li.mana-comment', function() {
23
        id = $(this).attr('data-id');
24
        mana_increment(id, 'resource_comment', 'nb');
25
    });
26
27
    $(document).on('click', 'ul li.mana-other-comment', function() {
28
        $('#mana-comment-box').modal('show');
29
    });
30
31
    $(document).on('click', '#mana-send-comment', function() {
32
        var resource_type = $('#mana-resource').val();
33
        var resource_id = $('#mana-resource-id').val();
34
        var comment = $("#mana-comment").val();
35
        mana_comment(resource_id, comment, resource_type);
36
        $("#mana-comment-box").modal("hide");
37
    });
38
39
    $(document).on('click', '#mana-comment-close', function() {
40
        $("#mana-comment-box").modal("hide");
41
    });
42
});
43
//]]>
44
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-comment-status.inc (+10 lines)
Line 0 Link Here
1
<div id="mana_comment_progress" class="dialog message mana_comment_status" style="display:none">
2
    <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Submitting comment </div>
3
</div>
4
<div id="mana_comment_success" class="dialog message mana_comment_status" style="display:none">
5
    Your comment has been submitted
6
</div>
7
<div id="mana_comment_failed" class="dialog alert mana_comment_status" style="display:none">
8
    Your comment could not be submitted. Please try again later.
9
    <div id="mana_comment_errortext"></div>
10
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-report-search-result.inc (-72 / +118 lines)
Lines 1-82 Link Here
1
[% USE Asset %]
1
[% USE KohaDates %]
2
[% USE KohaDates %]
2
[% USE Koha %]
3
[% USE Koha %]
3
[% USE AuthorisedValues %]
4
[% USE AuthorisedValues %]
4
[% USE Branches %]
5
[% USE Branches %]
5
[% USE raw %]
6
[% USE raw %]
6
7
7
<script>
8
[% INCLUDE 'doc-head-open.inc' %]
8
//<![CDATA[
9
<title>Koha &rsaquo; Reports &rsaquo; Mana Knowledge Base reports search</title>
9
$(document).ready(function() {
10
[% INCLUDE 'doc-head-close.inc' %]
10
    $(document).on('click', 'button.mana-use', function() {
11
[% Asset.css("css/reports.css") | $raw %]
11
        id = $(this).attr('id');
12
[% Asset.css("css/datatables.css") | $raw %]
12
        mana_use(id.substr(9));
13
</head>
13
    });
14
14
15
    $(document).on('change', 'select.mana-actions', function() {
15
<body id="rep_mana_search" class="rep">
16
        report_id = $(this).attr('id').substr(13);
16
[% INCLUDE 'header.inc' %]
17
        if ($(this).val() == 'other') {
17
[% INCLUDE 'circ-search.inc' %]
18
            $('input#selected_id').val(report_id);
19
            $('#comment_box').modal('show');
20
        } else {
21
            comment_id = $(this).val();
22
            mana_increment(comment_id, 'resource_comment', 'nb');
23
        }
24
    });
25
});
26
//]]>
27
</script>
28
[% INCLUDE 'mana.inc' %]
29
18
30
[% IF statuscode == "200" AND reports %]
19
<div id="breadcrumbs">
31
    <table id="mana_results_datatable" width=100%>
20
    <a href="/cgi-bin/koha/mainpage.pl">Home</a>
32
        <thead>
21
    &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
33
            <tr>
22
    &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
34
                <th>Report Name</th>
23
    &rsaquo; Mana Knowledge Base report search results
35
                <th class="anti-the" width=35%>Notes</th>
24
</div>
36
                <th>Type</th>
25
37
                <th title="number of libraries using this pattern"># of users</th>
26
<div class="main container-fluid">
38
                <th class="title-string" title="last time a library used this pattern">Last import</th>
27
    <div class="row">
39
                <th> Comments </th>
28
        <div class="col-sm-10 col-sm-push-2">
40
                [% UNLESS search_only %]
29
            <main>
41
                  <th class="NoSort">Actions</th>
30
                <h2>Mana Knowledge Base report search results</h2>
42
                [% END %]
31
43
            </tr>
32
                <div id="mana_results">
44
        </thead>
33
                    [% IF statuscode == "200" AND reports %]
45
        <tbody>
34
46
            [% FOREACH report IN reports %]
35
                        <table id="mana_results_datatable">
47
                [% UNLESS report.cannotdisplay %]
36
                            <thead>
48
                    [% IF report.nbofcomment > highWarned %]
37
                                <tr>
49
                  <tr id="row[% report.id | $raw %]" class = "high-warned-row">
38
                                    <th>Report name</th>
50
                    [% ELSIF report.nbofcomment > warned %]
39
                                    <th class="anti-the">Notes</th>
51
                  <tr id="row[% report.id | $raw %]" class = "warned-row">
40
                                    <th>Type</th>
52
                    [% ELSIF report.nbofcomment > lowWarned %]
41
                                    <th title="Number of libraries using this pattern"># of users</th>
53
                  <tr id="row[% report.id | $raw %]" class = "highlighted-row">
42
                                    <th class="title-string" title="Last time a library used this pattern">Last import</th>
54
                    [% END %]
43
                                    <th> Comments </th>
55
                    <input hidden class="rowid" value="[% report.id | $raw %]">
44
                                    [% UNLESS search_only %]
56
                    <td>[% IF ( report.report_name ) %][% report.report_name | html %][% END %]</td>
45
                                        <th class="NoSort">Actions</th>
57
                    <td title="[% report.savedsql | html %]"><div>
46
                                    [% END %]
58
                        [% IF report.notes.length > 200 %]
47
                                </tr>
59
                            [% report.notes.substr(0,200) | html %]<a class="showbutton">Show More</a></div><div hidden>
48
                            </thead>
60
                        [% END %]
49
                            <tbody>
61
                            [% report.notes | html %]
50
                                [% FOREACH report IN reports %]
62
                        [% IF report.notes.length > 200 %]
51
                                    [% UNLESS report.cannotdisplay %]
63
                                <a class="hidebutton">Show Less</a></div> </td>
52
                                        [% IF report.nbofcomment > highWarned %]
64
                        [% END %]
53
                                            <tr id="row[% report.id | html %]" class="high-warned-row">
65
                    <td> [% report.type | html %] </td>
54
                                        [% ELSIF report.nbofcomment > warned %]
66
                    <td>[% IF ( report.nbofusers ) %][% report.nbofusers | $raw %][% END %]</td>
55
                                            <tr id="row[% report.id | html %]" class="warned-row">
67
                    <td><span title="[% report.lastimport | $KohaDates %]">[% report.lastimport | $KohaDates %]</span></td>
56
                                        [% ELSIF report.nbofcomment > lowWarned %]
68
                    <td>[% FOREACH comment IN report.comments %][% comment.message | html %] ([% comment.nb | $raw %]) <br>[% END %]</td>
57
                                            <tr id="row[% report.id | html %]" class="highlighted-row">
58
                                        [% ELSE %]
59
                                            <tr id="row[% report.id | html %]">
60
                                        [% END %]
61
                                        <td>
62
                                            <input type="hidden" class="rowid" value="[% report.id | $raw %]" />
63
                                            [% IF ( report.report_name ) %]
64
                                                [% report.report_name | html %]
65
                                            [% END %]
66
                                        </td>
67
                                        <td title="[% report.savedsql | html %]">
68
                                            [% IF report.notes.length > 200 %]
69
                                                <div>
70
                                                    [% report.notes.substr(0,200) | html %]... <a href="#" class="btn btn-link btn-sm showbutton"><i class="fa fa-plus-square-o"></i> Show more</a>
71
                                                </div>
72
                                                <div style="display:none">
73
                                                    [% report.notes | html %]
74
                                                    <a href="#" class="btn btn-link btn-sm hidebutton"><i class="fa fa-minus-square-o"></i> Show less</a>
75
                                                </div>
76
                                            [% ELSE %]
77
                                                [% report.notes | html %]
78
                                            [% END %]
79
                                        </td>
80
                                        <td> [% report.type | html %] </td>
81
                                        <td>
82
                                            [% IF ( report.nbofusers ) %]
83
                                                [% report.nbofusers | html %]
84
                                            [% END %]
85
                                        </td>
86
                                        <td>
87
                                            <span title="[% report.lastimport | html %]">
88
                                                [% report.lastimport | $KohaDates %]
89
                                            </span>
90
                                        </td>
91
                                        <td>
92
                                            [% FOREACH comment IN report.comments %]
93
                                                [% comment.message | html %] ([% comment.nb | html %])<br>
94
                                            [% END %]
95
                                        </td>
69
96
70
                    [% UNLESS search_only %]
97
                                        [% UNLESS search_only %]
71
                        <td>
98
                                            <td>
72
                            <button class="mana-use" id="mana-use-[% report.id | $raw %]"><i class="fa fa-inbox"></i> Use</button>
99
                                                <button type="button" class="btn btn-default btn-xs mana-use" id="mana-use-[% report.id | html %]" data-report_id="[% report.id | html %]"><i class="fa fa-download"></i> Import</button>
73
                        </td>
100
                                            </td>
101
                                        [% END %]
102
                                      </tr>
103
                                    [% END %]
104
                                [% END %]
105
                            </tbody>
106
                        </table>
107
                    [% ELSE %]
108
                        <h4>
109
                            [% IF ( msg ) %]
110
                                [% msg | html %] (Statuscode: [% statuscode | html %])
111
                            [% ELSE %]
112
                                No results found
113
                            [% END %]
114
                        </h4>
74
                    [% END %]
115
                    [% END %]
75
                  </tr>
116
                </div>
76
                [% END %]
117
77
            [% END %]
118
            </main>
78
        </tbody>
119
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
79
    </table>
120
80
[% ELSE %]
121
        <div class="col-sm-2 col-sm-pull-10">
81
    <h4> [% msg | html %]  statuscode: [% statuscode | $raw %]</h4>
122
            <aside>
82
[% END %]
123
                [% INCLUDE 'guided-reports-view.inc' %]
124
            </aside>
125
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
126
     </div> <!-- /.row -->
127
128
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-share-report.inc (+95 lines)
Line 0 Link Here
1
<div id="mana_share_report" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_share_modal_label">
2
    <div class="modal-dialog modal-wide" role="document">
3
        <div class="modal-content">
4
            <form method="post" id="mana_share_form" action="/cgi-bin/koha/reports/guided_reports.pl">
5
                <div class="modal-header">
6
                    <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
7
                    <h3 id="mana_share_modal_label">Share with Mana</h3>
8
                </div>
9
                <div class="modal-body">
10
                    [% IF (mana_id) %]
11
                        <div class="dialog alert">
12
                            <p>Your report is already linked with a Mana report. Share it if you have made modifications, otherwise it will do nothing.</p>
13
                        </div>
14
                    [% END %]
15
                    <div id="note-error" class="dialog alert" role="alert">
16
                        Please enter a report name and descriptive note before sharing (minimum 20 characters)
17
                    </div>
18
                    <div class="shared_infos rows">
19
                        <ul>
20
                            <li><span class="label">Id: </span><div id="shared_id"></div></li>
21
                            <li><span class="label">Name: </span><div id="shared_name"></div></li>
22
                            <li><span class="label">SQL: </span><div id="shared_sql"></div></li>
23
                            <li><span class="label">Group: </span><div id="shared_group"></div></li>
24
                            <li><span class="label">Type: </span><div id="shared_type"></div></li>
25
                            <li><span class="label">Notes: </span><div id="shared_notes"></div></li>
26
                            [% IF (languages_loop) %]
27
                                <li>
28
                                    <input type="hidden" name="phase" value="Share">
29
                                    <label for="mana_language">Language:</label>
30
                                    <select id="mana_language" name="mana_language">
31
                                        [% FOREACH languages_loo IN languages_loop %]
32
                                            [% IF ( languages_loo.group_enabled ) %]
33
                                                [% IF ( languages_loo.plural ) %]
34
                                                    [% FOREACH sublanguages_loo IN languages_loo.sublanguages_loop %]
35
                                                        [% IF ( sublanguages_loo.enabled ) %]
36
                                                            [% IF ( sublanguages_loo.sublanguage_current ) %]
37
                                                                <option value="[% languages_loo.rfc4646_subtag | html %]" selected="selected">
38
                                                                    [% sublanguages_loo.native_description | html %]
39
                                                                    [% sublanguages_loo.script_description | html %]
40
                                                                    [% sublanguages_loo.region_description | html %]
41
42
                                                                    [% sublanguages_loo.variant_description | html %]
43
                                                                    ([% sublanguages_loo.rfc4646_subtag | html %])
44
                                                                </option>
45
                                                            [% ELSE %]
46
                                                                <option value="[% languages_loo.rfc4646_subtag | html %]">
47
                                                                    [% sublanguages_loo.native_description | html %]
48
                                                                    [% sublanguages_loo.script_description | html %]
49
                                                                    [% sublanguages_loo.region_description | html %]
50
                                                                    [% sublanguages_loo.variant_description | html %]
51
                                                                    ([% sublanguages_loo.rfc4646_subtag | html %])
52
                                                                </option>
53
                                                            [% END %]
54
                                                        [% END %]
55
                                                    [% END %]
56
                                                [% ELSE %]
57
                                                    [% IF ( languages_loo.group_enabled ) %]
58
                                                        [% IF ( languages_loo.current ) %]
59
                                                            <option value="[% languages_loo.rfc4646_subtag | html %]" selected="selected">
60
                                                                [% IF ( languages_loo.native_description ) %]
61
                                                                    [% languages_loo.native_description | html %]
62
                                                                [% ELSE %]
63
                                                                    [% languages_loo.rfc4646_subtag | html %]
64
                                                                [% END %]
65
                                                            </option>
66
                                                        [% ELSE %]
67
                                                            <option value="[% languages_loo.rfc4646_subtag | html %]">
68
                                                                [% IF ( languages_loo.native_description ) %]
69
                                                                    [% languages_loo.native_description | html %]
70
                                                                [% ELSE %]
71
                                                                    [% languages_loo.rfc4646_subtag | html %]
72
                                                                [% END %]
73
                                                            </option>
74
                                                        [% END %]
75
                                                    [% END %]
76
                                                [% END %]
77
                                            [% END %]
78
                                        [% END %]
79
                                    </select>
80
                                </li>
81
                            [% ELSE %]
82
                                <input type="hidden" name="mana_language" value="[% lang | html %]" />
83
                            [% END %]
84
                        </ul>
85
                    </div> <!-- /.shared_infos rows -->
86
                </div> <!-- /.modal-body -->
87
                <div class="modal-footer">
88
                    <input type="hidden" id="reportid" name="reportid"/>
89
                    <button id="ManaShareButton" type="submit" class="btn btn-default shared_infos">Share</button>
90
                    <button class="btn btn-default" id="ManaCloseButton" data-dismiss="modal" aria-hidden="true">Cancel</button>
91
                </div>
92
            </form> <!-- /#mana_share_form -->
93
        </div> <!-- /.modal-content -->
94
    </div> <!-- /.modal-dialog -->
95
</div> <!-- /#mana_share_report -->
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-subscription-search-result.inc (-79 / +77 lines)
Lines 3-93 Link Here
3
[% USE AuthorisedValues %]
3
[% USE AuthorisedValues %]
4
[% USE Branches %]
4
[% USE Branches %]
5
[% USE raw %]
5
[% USE raw %]
6
[% INCLUDE 'mana.inc' %]
7
<script>
8
//<![CDATA[
9
$(document).ready(function() {
10
    $(document).on('click', 'button.mana-use', function() {
11
        id = $(this).attr('id');
12
        mana_use(id.substr(9));
13
    });
14
});
15
//]]>
16
</script>
17
6
18
[% IF statuscode == "200" %]
7
[% IF statuscode == "200" %]
19
    <table id="mana_results_datatable" width=100%>
8
    [% INCLUDE 'mana/mana-comment-status.inc' %]
20
        <thead>
9
    <div id="mana_results">
21
            <tr>
10
        <table id="mana_results_datatable">
22
                <th>ISSN</th>
11
            <thead>
23
                <th class="anti-the" width=50%>Title</th>
12
                <tr>
24
                <th> Published by </th>
13
                    <th>ISSN</th>
25
                <th>Frequency</th>
14
                    <th class="anti-the">Title</th>
26
                <th>Numbering pattern</th>
15
                    <th> Published by </th>
27
                <th title="number of libraries using this pattern"># of users</th>
16
                    <th>Frequency</th>
28
                <th class="title-string" title="last time a library used this pattern">Last import</th>
17
                    <th>Numbering pattern</th>
29
                <th> Comments </th>
18
                    <th title="Number of libraries using this pattern"># of users</th>
30
                [% UNLESS search_only %]
19
                    <th class="title-string" title="Last time a library used this pattern">Last import</th>
31
                  <th class="NoSort">Actions</th>
20
                    <th> Comments </th>
32
                [% END %]
21
                    [% UNLESS search_only %]
33
            </tr>
22
                      <th class="NoSort">Actions</th>
34
        </thead>
35
        <tbody>
36
            [% FOREACH subscription IN subscriptions %]
37
                [% UNLESS subscription.cannotdisplay %]
38
                    [% IF subscription.nbofcomment > highWarned  %]
39
                    <tr id="row[% subscription.subscriptionid | $raw %]" class = "high-warned-row" title="this resource has been reported more than [% highWarned | html %] times, take care!">
40
                    [% ELSIF subscription.nbofcomment > warned  %]
41
                    <tr id="row[% subscription.subscriptionid | $raw %]" class = "warned-row" title="this resource has been reported more than [% warned | html %] times, take care!">
42
                    [% ELSIF subscription.nbofcomment > lowWarned  %]
43
                    <tr id="row[% subscription.subscriptionid | $raw %]" class = "highlighted-row" title="this resource has been reported more than [% lowWarned | html %] times, take care!">
44
                    [% END %]
23
                    [% END %]
45
                    <input hidden class="rowid" value="[% subscription.id | $raw %]">
24
                </tr>
46
                        <td>[% IF ( subscription.issn ) %][% subscription.issn | html %][% END %]</td>
25
            </thead>
47
                        <td>[% subscription.title | html %]</a></td>
26
            <tbody>
48
                        <td>[% IF ( subscription.publishercode ) %][% subscription.publishercode | html %][% END %]</td>
27
                [% FOREACH subscription IN subscriptions %]
49
                        <td>[% IF ( subscription.sfdescription ) %][% subscription.sfdescription | html %][% END %]</td>
28
                    [% UNLESS subscription.cannotdisplay %]
50
                        <td>[% IF ( subscription.numberingmethod ) %][% subscription.numberingmethod | html %][% END %]</td>
29
                        [% IF subscription.nbofcomment > highWarned  %]
51
                        <td>[% IF ( subscription.nbofusers ) %][% subscription.nbofusers | $raw %][% END %]</td>
30
                            <tr id="row[% subscription.id | html %]" class="high-warned-row" title="This resource has been reported more than [% highWarned | html %] times, take care!">
52
                        <td><span title="[% subscription.lastimport | $KohaDates %]">[% subscription.lastimport | $KohaDates %]</span></td>
31
                        [% ELSIF subscription.nbofcomment > warned  %]
53
                        <td>[% FOREACH comment IN subscription.comments %][% comment.message | html %] ([% comment.nb | $raw %]) <br>[% END %]</td>
32
                            <tr id="row[% subscription.id | html %]" class="warned-row" title="This resource has been reported more than [% warned | html %] times, take care!">
54
33
                        [% ELSIF subscription.nbofcomment > lowWarned  %]
55
                        [% UNLESS search_only %]
34
                            <tr id="row[% subscription.id | html %]" class="highlighted-row" title="This resource has been reported more than [% lowWarned | html %] times, take care!">
35
                        [% ELSE %]
36
                            <tr id="row[% subscription.id | html %]">
37
                        [% END %]
38
                        <input type="hidden" hidden class="rowid" value="[% subscription.id | html %]" />
39
                            <td>[% IF ( subscription.issn ) %][% subscription.issn | html %][% END %]</td>
40
                            <td>[% subscription.title | html %]</td>
41
                            <td>[% IF ( subscription.publishercode ) %][% subscription.publishercode | html %][% END %]</td>
42
                            <td>[% IF ( subscription.sfdescription ) %][% subscription.sfdescription | html %][% END %]</td>
43
                            <td>[% IF ( subscription.numberingmethod ) %][% subscription.numberingmethod | html %][% END %]</td>
44
                            <td>[% IF ( subscription.nbofusers ) %][% subscription.nbofusers | html %][% END %]</td>
45
                            <td><span title="[% subscription.lastimport | html %]">[% subscription.lastimport | $KohaDates %]</span></td>
56
                            <td>
46
                            <td>
57
                                <button class="mana-use" id="mana-use-[% subscription.id | $raw %]"><i class="fa fa-inbox"></i> Use</button>
47
                                [% FOREACH comment IN subscription.comments %]
58
                                <select class="mana-actions" id="mana-actions-[% subscription.id | $raw %]">
48
                                    [% comment.message | html %] ([% comment.nb | html %])<br />
59
                                    <option selected disabled>Report mistake</option>
49
                                [% END %]
60
                                    [% FOREACH comment IN subscription.comments %]
61
                                        <option value="[% comment.id | $raw %]"> [% comment.message | html %] ([% comment.nb | $raw %])</option>
62
                                    [% END %]
63
                                        <option>other</option>
64
                                </select>
65
                                <button hidden class="actionreport2" hidden> Cancel</button>
66
                            </td>
50
                            </td>
67
                        [% END %]
51
                            [% UNLESS search_only %]
68
                    </tr>
52
                                <td class="actions">
53
                                    <button class="btn btn-default btn-xs mana-use" data-subscription_id="[% subscription.id | html %]" id="mana-use-[% subscription.id | html %]"><i class="fa fa-download"></i> Import</button>
54
                                    <div class="dropup">
55
                                        <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
56
                                            Report <span class="caret"></span>
57
                                        </button>
58
                                        <ul class="dropdown-menu pull-right mana-actions" id="mana-actions-[% subscription.id | html %]">
59
                                            [% IF ( subscription.comments.size ) %]
60
                                                [% FOREACH comment IN subscription.comments %]
61
                                                    <li><a data-commentid="[% comment.id | html %]" data-resourceid="[% subscription.id | html %]" href="#">[% comment.message | html %] ([% comment.nb | html %])</a></li>
62
                                                [% END %]
63
                                                <li role="separator" class="divider"></li>
64
                                            [% END %]
65
                                            <li><a data-commentid="other" data-resourceid="[% subscription.id | html %]" href="#">New comment</a></li>
66
                                        </ul>
67
                                    </div>
68
                                </td>
69
                            [% END %]
70
                        </tr>
71
                    [% END %]
69
                [% END %]
72
                [% END %]
70
            [% END %]
73
            </tbody>
71
        </tbody>
74
        </table>
72
    </table>
75
    </div>
76
    <div id="new_mana_comment" style="display:none">
77
        <h4 id="mana_submit_comment"> Please enter a new comment (max 35 caracters)</h4>
78
        <form id="mana_comment_form" action="/cgi-bin/koha/serials/subscription-detail.pl" method="get">
79
            <input type="hidden" id="mana-resource" value="subscription" />
80
            <input type="hidden" id="mana-resource-id" value="[% mana_id | html %]" />
81
            <input type="text" maxlength="35" size="35" id="mana-comment" required="required" />
82
            <input type="hidden" id="selected_id" value="" />
83
            <div class="action">
84
                <button id="mana-send-comment">Submit</button>
85
                <a href="#" class="cancel" id="mana-comment-close">Cancel</a>
86
            </div>
87
        </form>
88
    </div>
73
[% ELSE %]
89
[% ELSE %]
74
    <h4>Mana search fails with the code: [% statuscode | html %] </h4>
90
    <h4>Mana search fails with the code: [% statuscode | html %] </h4>
75
[% END %]
91
[% END %]
76
77
<div id="comment_box" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="display: none;">
78
    <div class="modal-dialog modal-lg" style="width: 30%">
79
        <div class="modal-content" style="">
80
            <div class="modal-header">
81
                <button type="button" id="commentCloseButton" class="closebtn" aria-hidden="true">×</button>
82
                <h3 id="mana_submit_comment"> Please enter a new commment (max 35 caracters)</h3>
83
            </div>
84
            <div class="modal-body">
85
                <form>
86
                    <input hidden id="selected_id" value="">
87
                    <input type="text" id="manamsg"> Comment:
88
                </form>
89
                <button id="CommentButton"> Comment </button>
90
            </div>
91
        </div>
92
    </div>
93
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc (-101 / +32 lines)
Lines 7-13 Link Here
7
                <li id="newmenuc"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">New guided report</a> </li>
7
                <li id="newmenuc"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">New guided report</a> </li>
8
                <li id="newsql"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create%20report%20from%20SQL">New SQL report</a> </li>
8
                <li id="newsql"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create%20report%20from%20SQL">New SQL report</a> </li>
9
                [% IF Koha.Preference('Mana')==1 %]
9
                [% IF Koha.Preference('Mana')==1 %]
10
                <li id="newsql"><a href="" data-toggle="modal" data-target="#mana_search_result">New SQL from Mana</a> </li>
10
                    <li id="new_mana_sql"><a href="#" data-toggle="modal" data-target="#mana_search_result">New SQL from Mana</a> </li>
11
                [% END %]
11
                [% END %]
12
            </ul>
12
            </ul>
13
        </div>
13
        </div>
Lines 64-75 Link Here
64
                </ul>
64
                </ul>
65
            </div>
65
            </div>
66
66
67
            <div id="mana-comment-box" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="display: none;">
67
            <div id="mana-comment-box" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label">
68
                <div class="modal-dialog modal-lg" style="width: 30%">
68
                <div class="modal-dialog modal-lg" role="document">
69
                    <div class="modal-content" style="">
69
                    <div class="modal-content">
70
                        <div class="modal-header">
70
                        <div class="modal-header">
71
                            <button type="button" id="mana-comment-close" class="closebtn"  aria-hidden="true">×</button>
71
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
72
                            <h3 id="mana_submit_comment"> Please enter a new commment (max 35 caracters)</h3>
72
                            <h3 id="mana_submit_comment">Enter a new commment (max 35 caracters)</h3>
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">
Lines 115-222 Link Here
115
</div>
115
</div>
116
116
117
[% IF Koha.Preference('Mana')==1 %]
117
[% IF Koha.Preference('Mana')==1 %]
118
    <div id="mana_search_result" class="modal fade container-fluid" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="width: 100%; left:0%; margin-left: auto; display: none;">
118
    <div id="mana_search_result" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label">
119
        <div class="modal-dialog modal-lg">
119
        <div class="modal-dialog modal-lg">
120
            <div class="modal-content">
120
            <form id="mana_search_form">
121
                <div class="modal-header">
121
                <div class="modal-content">
122
                    <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
122
                    <div class="modal-header">
123
                    <h3 id="mana_search_result_label"> Mana Search</h3>
123
                        <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
124
                </div>
124
                        <h3 id="mana_search_result_label">Mana search</h3>
125
                <div>
125
                    </div>
126
                    <div class="modal-body">
126
                    <div class="modal-body">
127
                        <div id="mana_search_failed" class="dialog alert mana_search_status" style="display:none">
128
                            Your search could not be completed. Please try again later.
129
                            <div id="mana_search_errortext"></div>
130
                        </div>
131
                        <div id="mana_use_failed" class="dialog alert mana_search_status" style="display:none">
132
                            This report could not be imported. Please try again later.
133
                            <div id="mana_use_errortext"></div>
134
                        </div>
127
                        <fieldset>
135
                        <fieldset>
128
                            <form id="mana_search_form" style="margin-left: 5%">
136
                            <p>
129
                                Please enter a few key words:
137
                                Search reports by keyword:
130
                                <input type="text" id="mana_search_field">
138
                                <input type="text" id="mana_search_field" />
131
                                <input type="submit" class="mana_search_button" value="Search">
139
                                <input type="submit" class="mana_search_button" value="Search" />
132
                            </form>
140
                                <span id="mana-loading" style="display:none"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </span>
141
                            </p>
133
                        </fieldset>
142
                        </fieldset>
134
                        <div class="mana_result_content">
143
                        <div id="mana_result_content">
135
                        </div>
144
                        </div>
136
                    </div>
145
                    </div>
146
                    <div class="modal-footer">
147
                        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
148
                    </div>
137
                </div>
149
                </div>
138
            </div>
150
            </form>
139
        </div>
151
        </div>
140
    </div>
152
    </div>
141
[% END %]
153
[% END %]
142
143
<script>
144
    function mana_use( mana_id ){
145
        $.ajax( {
146
            type:"POST",
147
            url: "/cgi-bin/koha/svc/mana/use",
148
            data: {id:mana_id, resource: 'report', saveinbase: 1},
149
            dataType: "json",
150
        })
151
        .done( function (result){
152
            if ( result.errmsg ){
153
                alert( result.errmsg );
154
            }
155
            else{
156
                window.location = ("/cgi-bin/koha/reports/guided_reports.pl?reports=").concat(result.id).concat("&amp;phase=Show%20SQL&mana_success=1&phase=Edit%20SQL");
157
            }
158
        })
159
        .fail( function ( foo, msg, longmsg, bla ){
160
        });
161
    }
162
163
    function mana_search( textquery ){
164
        $(document.body).css({'cursor' : 'wait'});
165
        $.ajax({
166
            type: "POST",
167
            url: "/cgi-bin/koha/svc/mana/search",
168
            data: {biblionumber: $("#biblionumber").val(), resource: 'report', id: textquery, usecomments: 1},
169
            dataType: "html",
170
        })
171
        .done( function( result ) {
172
            $(document.body).css({'cursor' : 'default'});
173
            $("#mana_search_result .modal-body .mana_result_content").html(result);
174
            $("#mana_search_result_label").text(_("Results from Mana Knowledge Base"));
175
            $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults,{
176
                "sPaginationType":"four_button",
177
                "autoWidth": false,
178
                "columnDefs": [
179
                    { "width": "35%", "targets": 1 }
180
                ],
181
                "aoColumnDefs": [
182
                    { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
183
                    { "sType": "title-string", "aTargets" : [ "title-string" ] },
184
                    { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
185
                ]
186
            }));
187
            if($("td.dataTables_empty").length == 0){
188
                 $("#mana_search").show();
189
            }
190
191
            $( "select[class='actionreport1']" ).show();
192
            $( "button[class='actionreport2']" ).hide();
193
194
            $(".showbutton").on("click", function(){
195
                $(this).parent().hide();
196
                $(this).parent().next().show();
197
            });
198
199
            $("a[class='hidebutton']").on("click", function(){
200
                $(this).parent().hide();
201
                $(this).parent().prev().show();
202
            });
203
204
            $("#commentCloseButton").on("click", function(){
205
                $("#comment_box").modal("hide");
206
            });
207
208
            $(".actionreport1").on("click", function(){
209
                $("#selectedcomment").val($(this).val());
210
                $(this).parent("select").hide();
211
                $(this).parent("select").next().show();
212
            });
213
214
            $(".actionreport2").on("click", function(){
215
                $(this).hide();
216
                $(this).prev().show();
217
                mana_increment($("#selectedcomment").val(), 'resource_comment', 'nb', -1);
218
            });
219
        }).fail( function( result ){
220
        });
221
    }
222
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc (-49 / +53 lines)
Lines 8-20 Link Here
8
            [% ELSE %]
8
            [% ELSE %]
9
                <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
                <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>
10
            [% END %]
10
            [% END %]
11
            [% IF Koha.Preference('Mana') == 1 and Koha.Preference('AutoShareWithMana').grep('subscription').size == 0 %]
12
                [% IF one_language_enabled==0 or mana_id %]
13
                    <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>
14
                [% ELSE %]
15
                    <div class="btn-group" id="mana-subscription-share" data-toggle="tooltip" title="Share the subscription with other libraries. Your email address will be associated to your sharing."><a class="btn btn-default btn-sm"><i class="fa fa-share-alt"></i> Share</a></div>
16
                [% END %]
17
            [% END %]
18
        [% END %]
11
        [% END %]
19
12
20
        [% IF ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription ) %]
13
        [% IF ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription ) %]
Lines 72-109 Link Here
72
            [% END %]
65
            [% END %]
73
        [% END %]
66
        [% END %]
74
67
68
        [% IF Koha.Preference('Mana') == 1 and Koha.Preference('AutoShareWithMana').grep('subscription').size == 0 %]
69
            [% IF one_language_enabled==0 or mana_id %]
70
                <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>
71
            [% ELSE %]
72
                <div class="btn-group" id="mana-subscription-share" data-toggle="tooltip" title="Share the subscription with other libraries. Your email address will be associated to your sharing."><a class="btn btn-default btn-sm"><i class="fa fa-share-alt"></i> Share</a></div>
73
            [% END %]
74
        [% END %]
75
75
        [% IF ( mana_id && Koha.Preference('Mana') == 1 ) %]
76
        [% IF ( mana_id && Koha.Preference('Mana') == 1 ) %]
76
            <div class="btn-group">
77
            <div class="btn-group">
77
                <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"> Report mistake <span class="caret"></span></button>
78
                <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"> Report mistake <span class="caret"></span></button>
78
                <ul class="dropdown-menu">
79
                <ul class="dropdown-menu mana-actions">
79
                    [% FOREACH c IN mana_comments %]
80
                    [% IF ( mana_comments ) %]
80
                        <li class="mana-comment" data-id="[% c.id | $raw %]">
81
                        [% FOREACH c IN mana_comments %]
81
                            <a href="#">[% c.message | html %] ([% c.nb | html %])</a>
82
                            <li>
82
                        </li>
83
                                <a data-commentid="[% c.id | html %]" data-resourceid="[% mana_id | html %]" href="#">[% c.message | html %] ([% c.nb | html %])</a>
84
                            </li>
85
                        [% END %]
86
                        <li role="separator" class="divider"></li>
83
                    [% END %]
87
                    [% END %]
84
                    <li role="separator" class="divider"></li>
88
                    <li><a data-commentid="other" data-resourceid="[% mana_id | html %]" href="#">New comment</a></li>
85
                    <li class="mana-other-comment"><a href="#">Other</a> </li>
86
                </ul>
89
                </ul>
87
            </div>
90
            </div>
88
89
            <div id="mana-comment-box" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="display: none;">
90
                <div class="modal-dialog modal-lg" style="width: 30%">
91
                    <div class="modal-content" style="">
92
                        <div class="modal-header">
93
                            <button type="button" id="mana-comment-close" class="closebtn"  aria-hidden="true">×</button>
94
                            <h3 id="mana_submit_comment"> Please enter a new commment (max 35 caracters)</h3>
95
                        </div>
96
                        <div class="modal-body">
97
                            <input hidden id="mana-resource" value="subscription">
98
                            <input hidden id="mana-resource-id" value="[% mana_id | $raw %]">
99
                            <div>
100
                                <input type="text" maxlength="35" size="35" id="mana-comment">
101
                            </div>
102
                            <button id="mana-send-comment"> Comment </button>
103
                        </div>
104
                    </div>
105
                </div>
106
            </div>
107
        [% END %]
91
        [% END %]
108
    </div>
92
    </div>
109
[% ELSIF CAN_user_serials_create_subscription %]
93
[% ELSIF CAN_user_serials_create_subscription %]
Lines 116-137 Link Here
116
    </div>
100
    </div>
117
[% END %]
101
[% END %]
118
102
119
<div id="mana_share_modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mana_share_modal_label" style="display: none;">
103
<div class="modal" id="mana-comment-box" tabindex="-1" role="dialog" aria-labelledby="mana_submit_comment">
120
    <div class="modal-dialog">
104
    <div class="modal-dialog" role="document">
105
        <div class="modal-content">
106
            <form id="mana_comment_form" action="/cgi-bin/koha/serials/subscription-detail.pl" method="get">
107
                <div class="modal-header">
108
                    <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
109
                    <h4 class="modal-title" id="mana_submit_comment">Please enter a new comment (max 35 characters)</h4>
110
                </div>
111
                <div class="modal-body">
112
                    <input type="hidden" id="mana-resource" value="subscription" />
113
                    <input type="hidden" id="mana-resource-id" value="[% mana_id | html %]" />
114
                    <input type="text" maxlength="35" size="35" id="mana-comment" required="required" />
115
                    <button id="mana-send-comment">Submit</button>
116
                    <a href="#" class="cancel" id="mana-comment-close">Cancel</a>
117
                </div>
118
                <div class="modal-footer">
119
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
120
                </div>
121
            </form>
122
        </div> <!-- /.modal-content -->
123
    </div> <!-- /.modal-dialog -->
124
</div> <!-- /#mana-comment-box -->
125
126
<div id="mana_share_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_share_modal_label">
127
    <div class="modal-dialog" role="document">
121
        <div class="modal-content">
128
        <div class="modal-content">
122
            <div class="modal-header">
129
            <div class="modal-header">
123
                <h3 id="mana_share_modal_label">Share [% bibliotitle | html %] to Mana</h3>
130
                <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
131
                <h4 id="mana_share_modal_label">Share [% bibliotitle | html %] to Mana</h4>
124
            </div>
132
            </div>
125
            <div class="modal-body">
133
            <div class="modal-body">
126
                [% IF (mana_id) %]
134
                [% IF (mana_id) %]
127
                    <div class="alert">
135
                    <div class="alert">
128
<h1>[% mana_id | $raw %]</h1>
129
                        <p>Your subscription is already linked with a Mana subscription model. Share it if you have made modifications, otherwise it will do nothing.</p>
136
                        <p>Your subscription is already linked with a Mana subscription model. Share it if you have made modifications, otherwise it will do nothing.</p>
130
                    </div>
137
                    </div>
131
                [% END %]
138
                [% END %]
132
                [% IF ( languages_loop ) %]
139
                [% IF ( languages_loop ) %]
133
                    [% UNLESS ( one_language_enabled ) %]
140
                    [% UNLESS ( one_language_enabled ) %]
134
                        <div class="rows">
141
                        <div class="rows">
142
                            <ol>
135
                                <li><span class="label">Frequency: </span>
143
                                <li><span class="label">Frequency: </span>
136
                                        [% frequency.description | html %]
144
                                        [% frequency.description | html %]
137
                                </li>
145
                                </li>
Lines 194-214 Link Here
194
                                        [% END %]
202
                                        [% END %]
195
                                    </select>
203
                                    </select>
196
                                    <input type="hidden" id="op" name="op" value="share"/>
204
                                    <input type="hidden" id="op" name="op" value="share"/>
197
                                    <input type="hidden" id="subscriptionid" name="subscriptionid" value="[% subscriptionid | $raw %]"/>
205
                                    <input type="hidden" id="subscriptionid" name="subscriptionid" value="[% subscriptionid | html %]"/>
198
                                </fieldset>
206
                                </fieldset>
199
                            </form>
207
                            </form>
200
                        </div>
208
                        </div> <!-- /.rows -->
201
                    [% END %]
209
                    [% END %]
202
                [% END %]
210
                [% END %]
203
            </div>
211
            </div> <!-- /.modal-body -->
204
            <div class="modal-footer">
212
            <div class="modal-footer">
205
                <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
213
                <button type="submit" form="mana_share_form" class="btn btn-default">Share</button>
206
                [% IF one_language_enabled==0 %]
214
                <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>
207
                    <button type="submit" form="mana_share_form" class="btn btn-primary">Share</button>
208
                [% ELSE %]
209
                    <div class="btn-group" id="mana-subscription-share"><a class="btn btn-primary">Share</a></div>
210
                [% END %]
211
            </div>
215
            </div>
212
        </div>
216
        </div> <!-- /.modal-content -->
213
    </div>
217
    </div> <!-- /.modal-dialog -->
214
</div>
218
</div> <!-- /#mana-share-modal -->
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/mana/mana-report-search-result.tt (-1 / +1 lines)
Line 1 Link Here
1
[% INCLUDE 'mana/mana-report-search-result.inc' %]
1
[% INCLUDE 'mana/mana-report-search-result.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/mana/mana-subscription-search-result.tt (-1 / +1 lines)
Line 1 Link Here
1
[% INCLUDE 'mana/mana-subscription-search-result.inc' %]
1
[% INCLUDE 'mana/mana-subscription-search-result.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-117 / +96 lines)
Lines 39-44 Link Here
39
.CodeMirror {
39
.CodeMirror {
40
    resize:  vertical;
40
    resize:  vertical;
41
}
41
}
42
#mana_search_errortext { font-family: monospace; font-weight: bold; }
42
</style>
43
</style>
43
[% Asset.css("css/reports.css") | $raw %]
44
[% Asset.css("css/reports.css") | $raw %]
44
[% Asset.css("lib/d3c3/c3.min.css") | $raw %]
45
[% Asset.css("lib/d3c3/c3.min.css") | $raw %]
Lines 173-186 canned reports and writing custom SQL reports.</p> Link Here
173
                <option value="">All</option>
174
                <option value="">All</option>
174
            </select>
175
            </select>
175
        </div>
176
        </div>
176
<div style="display:inline-block">
177
    [% IF manamsg %]
178
     <div id="mana_search" class="dialog message">
179
        <p> [% manamsg | html %] </p>
180
    </div>
181
    [% END %]
182
177
183
</script>
178
        [% IF (Koha.Preference('Mana') == 1) %]
179
            [% IF manamsg %]
180
                <div id="mana_search_message" class="dialog message">
181
                    <p> [% manamsg | html %] </p>
182
                </div>
183
            [% END %]
184
        [% END %]
184
185
185
<form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
186
<form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
186
<input type="hidden" name="phase" value="Delete Multiple" />
187
<input type="hidden" name="phase" value="Delete Multiple" />
Lines 221-227 canned reports and writing custom SQL reports.</p> Link Here
221
                            [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
222
                            [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
222
                                <input type="checkbox" name="ids" value="[% savedreport.id | html %]" />
223
                                <input type="checkbox" name="ids" value="[% savedreport.id | html %]" />
223
                            [% END %]
224
                            [% END %]
224
                        <input hidden class="report_sql" value="[% savedreport.savedsql |html %]">
225
                            <input type="hidden" class="report_sql" value="[% savedreport.savedsql |html %]">
225
                        </td>
226
                        </td>
226
                        <td class="report_id"><label for="ids">[% savedreport.id | html %]</label></td>
227
                        <td class="report_id"><label for="ids">[% savedreport.id | html %]</label></td>
227
                        <td class="report_name">
228
                        <td class="report_name">
Lines 296-302 canned reports and writing custom SQL reports.</p> Link Here
296
                [% END %]
297
                [% END %]
297
            </tbody>
298
            </tbody>
298
        </table>
299
        </table>
299
</div>
300
300
        [% IF ( CAN_user_reports_delete_reports ) %]
301
        [% IF ( CAN_user_reports_delete_reports ) %]
301
        <fieldset class="action">
302
        <fieldset class="action">
302
            <input type="submit" value="Delete selected" />
303
            <input type="submit" value="Delete selected" />
Lines 337-442 canned reports and writing custom SQL reports.</p> Link Here
337
[% END %]
338
[% END %]
338
[% END %]
339
[% END %]
339
340
340
<div id="mana_share_report" class="modal fade" tabindex="-1" role="dialog" arialabelledby="mana_share_modal_label" style="display: none;">
341
[% INCLUDE 'mana/mana-share-report.inc' %]
341
    <div class="modal-dialog">
342
        <div class="modal-content">
343
            <div class="modal-header">
344
                <h3 id="mana_share_modal_label">Share with Mana</h3>
345
            </div>
346
            <div class="modal-body">
347
                [% IF (mana_id) %]
348
                    <div class="alert">
349
                        <p>Your subscription is already linked with a Mana subscription model. Share it if you have made modifications, otherwise it will do nothing.</p>
350
                    </div>
351
                [% END %]
352
                <div id="note-error" class="alert alert-danger" role="alert">
353
                    Please enter a report name and descriptive note before sharing (minimum 20 characters)
354
                </div>
355
                <div class="shared_infos rows">
356
                    <li><span class="label">Id: </span><div id="shared_id"></div></li>
357
                    <li><span class="label">Name: </span><div id="shared_name"></div></li>
358
                    <li><span class="label">SQL: </span><div id="shared_sql"></div></li>
359
                    <li><span class="label">Group: </span><div id="shared_group"></div></li>
360
                    <li><span class="label">Type: </span><div id="shared_type"></div></li>
361
                    <li><span class="label">Notes: </span><div id="shared_notes"></div></li>
362
                </div>
363
                <div class="rows">
364
                    <form method="post" id="mana_share_form" action="/cgi-bin/koha/reports/guided_reports.pl" class="validated" >
365
                        <input type="hidden" name="phase" value="Share">
366
367
                        [% IF (languages_loop) %]
368
                            <fieldset class="shared_infos">
369
                                <label for="mana_language">Language:</label>
370
                                <select id="mana_language" name="mana_language">
371
                                    [% FOREACH languages_loo IN languages_loop %]
372
                                        [% IF ( languages_loo.group_enabled ) %]
373
                                            [% IF ( languages_loo.plural ) %]
374
                                                [% FOREACH sublanguages_loo IN languages_loo.sublanguages_loop %]
375
                                                    [% IF ( sublanguages_loo.enabled ) %]
376
                                                        [% IF ( sublanguages_loo.sublanguage_current ) %]
377
                                                            <option value="[% languages_loo.rfc4646_subtag | html %]" selected>
378
                                                                [% sublanguages_loo.native_description | html %]
379
                                                                [% sublanguages_loo.script_description | html %]
380
                                                                [% sublanguages_loo.region_description | html %]
381
382
                                                                [% sublanguages_loo.variant_description | html %]
383
                                                                ([% sublanguages_loo.rfc4646_subtag | html %])
384
                                                            </option>
385
                                                        [% ELSE %]
386
                                                            <option value="[% languages_loo.rfc4646_subtag | html %]">
387
                                                                [% sublanguages_loo.native_description | html %]
388
                                                                [% sublanguages_loo.script_description | html %]
389
                                                                [% sublanguages_loo.region_description | html %]
390
                                                                [% sublanguages_loo.variant_description | html %]
391
                                                                ([% sublanguages_loo.rfc4646_subtag | html %])
392
                                                            </option>
393
                                                        [% END %]
394
                                                    [% END %]
395
                                                [% END %]
396
                                            [% ELSE %]
397
                                                [% IF ( languages_loo.group_enabled ) %]
398
                                                    [% IF ( languages_loo.current ) %]
399
                                                        <option value="[% languages_loo.rfc4646_subtag | html %]" selected>
400
                                                            [% IF ( languages_loo.native_description ) %]
401
                                                                [% languages_loo.native_description | html %]
402
                                                            [% ELSE %]
403
                                                                [% languages_loo.rfc4646_subtag | html %]
404
                                                            [% END %]
405
                                                        </option>
406
                                                    [% ELSE %]
407
                                                        <option value="[% languages_loo.rfc4646_subtag | html %]">
408
                                                            [% IF ( languages_loo.native_description ) %]
409
                                                                [% languages_loo.native_description | html %]
410
                                                            [% ELSE %]
411
                                                                [% languages_loo.rfc4646_subtag | html %]
412
                                                            [% END %]
413
                                                        </option>
414
                                                    [% END %]
415
                                                [% END %]
416
                                            [% END %]
417
                                        [% END %]
418
                                    [% END %]
419
                                </select>
420
                            </fieldset>
421
                        [% ELSE %]
422
                            <input type="hidden" name="mana_language" value="[% lang | html %]">
423
                        [% END %]
424
                        <input type="hidden" id="reportid" name="reportid"/>
425
                    </form>
426
                </div>
427
            </div>
428
            <div class="modal-footer">
429
                <button class="btn" id="ManaCloseButton" data-dismiss="modal" aria-hidden="true">Close</button>
430
                [% IF one_language_enabled==0 %]
431
                    <button id="ManaShareButton" type="submit" form="mana_share_form" class="btn btn-primary shared_infos">Share</button>
432
                [% ELSE %]
433
                    <div id="ManaShareButton" class="btn-group"><a class="btn btn-primary shared_infos">Share</a></div>
434
                [% END %]
435
            </div>
436
        </div>
437
    </div>
438
</div>
439
440
342
441
[% IF ( build1 ) %]
343
[% IF ( build1 ) %]
442
[% IF ( cache_error) %]
344
[% IF ( cache_error) %]
Lines 1058-1064 canned reports and writing custom SQL reports.</p> Link Here
1058
[% END %]
960
[% END %]
1059
961
1060
962
1061
[% INCLUDE 'guided-reports-view.inc' %]
963
                [% INCLUDE 'guided-reports-view.inc' %]
1062
            </aside>
964
            </aside>
1063
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
965
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1064
     </div> <!-- /.row -->
966
     </div> <!-- /.row -->
Lines 1069-1081 canned reports and writing custom SQL reports.</p> Link Here
1069
    [% Asset.js("lib/d3c3/d3.min.js") | $raw %]
971
    [% Asset.js("lib/d3c3/d3.min.js") | $raw %]
1070
    [% Asset.js("lib/d3c3/c3.min.js") | $raw %]
972
    [% Asset.js("lib/d3c3/c3.min.js") | $raw %]
1071
    [% INCLUDE 'calendar.inc' %]
973
    [% INCLUDE 'calendar.inc' %]
1072
    [% INCLUDE 'mana.inc' %]
974
    [% INCLUDE 'datatables.inc' %]
1073
    [% IF ( saved1 ) %]
975
    [% IF ( saved1 ) %]
1074
        [% INCLUDE 'datatables.inc' %]
1075
        [% INCLUDE 'columns_settings.inc' %]
976
        [% INCLUDE 'columns_settings.inc' %]
1076
    [% END %]
977
    [% END %]
1077
    [% Asset.js( "lib/codemirror/codemirror-compressed.js" ) | $raw %]
978
    [% Asset.js( "lib/codemirror/codemirror-compressed.js" ) | $raw %]
1078
    [% Asset.js( "lib/codemirror/sql.min.js" ) | $raw %]
979
    [% Asset.js( "lib/codemirror/sql.min.js" ) | $raw %]
980
    [% Asset.js( "js/mana.js" ) | $raw %]
1079
    <script>
981
    <script>
1080
982
1081
        function hide_bar_element() {
983
        function hide_bar_element() {
Lines 1273-1279 canned reports and writing custom SQL reports.</p> Link Here
1273
                window.history.back();
1175
                window.history.back();
1274
            });
1176
            });
1275
1177
1276
            $(".mana_search_button").on("click",function(){
1178
            $("body").on("click", ".mana_search_button", function(){
1179
                $("#mana-loading").show();
1277
                mana_search($("#mana_search_field").val());
1180
                mana_search($("#mana_search_field").val());
1278
            });
1181
            });
1279
1182
Lines 1487-1496 canned reports and writing custom SQL reports.</p> Link Here
1487
                return confirmDelete(MSG_CONFIRM_DELETE);
1390
                return confirmDelete(MSG_CONFIRM_DELETE);
1488
            });
1391
            });
1489
1392
1490
            $('div#ManaShareButton').click(function() {
1491
                $("#mana_share_form").submit();
1492
            });
1493
1494
            $("#mana_search_form").submit(function(e){
1393
            $("#mana_search_form").submit(function(e){
1495
                e.preventDefault();
1394
                e.preventDefault();
1496
            });
1395
            });
Lines 1503-1508 canned reports and writing custom SQL reports.</p> Link Here
1503
                $("#selectedColumns option").attr("selected", "selected");  // Select everything still in #selectedColumns
1402
                $("#selectedColumns option").attr("selected", "selected");  // Select everything still in #selectedColumns
1504
                return true;
1403
                return true;
1505
            });
1404
            });
1405
1406
            // Mana KB
1407
            $("body").on("click", ".mana-use", function(e) {
1408
                e.preventDefault();
1409
                $(this).find("i").attr("class","fa fa-refresh fa-spin");
1410
                mana_use( $(this).data("report_id") );
1411
            });
1412
1413
            $("#mana_search_result").on("hide.bs.modal", function(){
1414
                $("#mana_result_content").html("");
1415
                $("#mana_search_field").val("");
1416
            });
1506
        });
1417
        });
1507
1418
1508
        function addColumn() {
1419
        function addColumn() {
Lines 1511-1516 canned reports and writing custom SQL reports.</p> Link Here
1511
        function delColumn() {
1422
        function delColumn() {
1512
            $("#selectedColumns option:selected").remove();
1423
            $("#selectedColumns option:selected").remove();
1513
        }
1424
        }
1425
1426
        // Mana KB
1427
        function mana_use( mana_id ){
1428
            $.ajax( {
1429
                type:"POST",
1430
                url: "/cgi-bin/koha/svc/mana/use",
1431
                data: {id:mana_id, resource: 'report', saveinbase: 1},
1432
                dataType: "json",
1433
            })
1434
            .done( function (result){
1435
                if ( result.errmsg ){
1436
                    alert( result.errmsg );
1437
                }
1438
                else{
1439
                    window.location = ("/cgi-bin/koha/reports/guided_reports.pl?reports=").concat(result.id).concat("&phase=Show%20SQL&mana_success=1");
1440
                }
1441
            })
1442
            .fail(function( error ) {
1443
                $(".mana_use_status").hide();
1444
                $("#mana_use_errortext").html( error.status + " " + error.statusText );
1445
                $("#mana_use_failed").show();
1446
                $(".mana-use i").attr("class","fa fa-download");
1447
            });
1448
        }
1449
1450
        function mana_search( textquery ){
1451
            $(".mana_search_status").hide();
1452
            $("#mana_result_content").load("/cgi-bin/koha/svc/mana/search #mana_results", { resource: 'report', id: textquery, usecomments: 1 }, function( response, status, xhr ) {
1453
1454
                    if ( status == "error" ) {
1455
                        $("#mana_search_errortext").html( xhr.status + " " + xhr.statusText );
1456
                        $("#mana_search_failed").show();
1457
                        $("#mana-loading").hide();
1458
                    } else {
1459
                        $(".mana_search_status").hide();
1460
                        $("#mana_search_result_label").text(_("Results from Mana Knowledge Base"));
1461
                        $("#mana-loading").hide();
1462
                        $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults,{
1463
                            "sPaginationType":"four_button",
1464
                            "autoWidth": false,
1465
                            "columnDefs": [
1466
                                { "width": "35%", "targets": 1 }
1467
                            ],
1468
                            "aoColumnDefs": [
1469
                                { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
1470
                                { "sType": "title-string", "aTargets" : [ "title-string" ] },
1471
                                { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
1472
                            ]
1473
                        }));
1474
1475
                        $(".showbutton").on("click", function(e){
1476
                            e.preventDefault();
1477
                            $(this).parent().hide();
1478
                            $(this).parent().next().show();
1479
                        });
1480
1481
                        $(".hidebutton").on("click", function(e){
1482
                            e.preventDefault();
1483
                            $(this).parent().hide();
1484
                            $(this).parent().prev().show();
1485
                        });
1486
1487
                        if($("td.dataTables_empty").length == 0){
1488
                            $("#mana_search_message").show();
1489
                        }
1490
                    }
1491
                });
1492
        }
1514
    </script>
1493
    </script>
1515
[% END %]
1494
[% END %]
1516
1495
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt (-1 lines)
Lines 420-426 Link Here
420
[% MACRO jsinclude BLOCK %]
420
[% MACRO jsinclude BLOCK %]
421
    [% INCLUDE 'calendar.inc' %]
421
    [% INCLUDE 'calendar.inc' %]
422
    [% INCLUDE 'datatables.inc' %]
422
    [% INCLUDE 'datatables.inc' %]
423
    [% INCLUDE 'mana.inc' %]
424
    <script>
423
    <script>
425
        var subscriptionid = "[% subscriptionid | html %]";
424
        var subscriptionid = "[% subscriptionid | html %]";
426
        var MSG_CLOSE_SUBSCRIPTION = _("Are you sure you want to close this subscription?");
425
        var MSG_CLOSE_SUBSCRIPTION = _("Are you sure you want to close this subscription?");
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (-10 / +32 lines)
Lines 7-14 Link Here
7
[% INCLUDE 'doc-head-open.inc' %]
7
[% INCLUDE 'doc-head-open.inc' %]
8
<title>Koha &rsaquo; Serials &rsaquo; [% IF ( modify ) %][% bibliotitle | html %] &rsaquo; Modify subscription[% ELSE %]New subscription[% END %]</title>
8
<title>Koha &rsaquo; Serials &rsaquo; [% IF ( modify ) %][% bibliotitle | html %] &rsaquo; Modify subscription[% ELSE %]New subscription[% END %]</title>
9
[% INCLUDE 'doc-head-close.inc' %]
9
[% INCLUDE 'doc-head-close.inc' %]
10
[% Asset.css("css/datatables.css") | $raw %]
10
<style>
11
<style>
11
fieldset.rows li.radio { width: 100%; } /* override staff-global.css */
12
fieldset.rows li.radio { width: 100%; } /* override staff-global.css */
13
#mana_comment_errortext { font-weight: bold; font-family: monospace;}
14
/* Prevents Bootstrap menus from being hidden inside modal */
15
#mana_search_result .modal { overflow: visible; }
16
#mana_search_result .modal-body { overflow-y: visible; }
12
</style>
17
</style>
13
</head>
18
</head>
14
19
Lines 27-34 fieldset.rows li.radio { width: 100%; } /* override staff-global.css */ Link Here
27
32
28
<div class="main container-fluid">
33
<div class="main container-fluid">
29
    <div class="row">
34
    <div class="row">
30
35
            <div class="col-sm-12">
31
            <h1>[% IF ( modify ) %] Modify subscription for <i>[% bibliotitle | html %]</i>[% ELSE %]Add a new subscription[% END %] (<span id="page_number">1/2</span>)</h1>
36
                <h1>[% IF ( modify ) %] Modify subscription for <i>[% bibliotitle | html %]</i>[% ELSE %]Add a new subscription[% END %] (<span id="page_number">1/2</span>)</h1>
37
            </div>
32
            <form method="post" id="subscription_add_form" name="f" action="/cgi-bin/koha/serials/subscription-add.pl" class="validated">
38
            <form method="post" id="subscription_add_form" name="f" action="/cgi-bin/koha/serials/subscription-add.pl" class="validated">
33
                [% IF ( modify ) %]
39
                [% IF ( modify ) %]
34
                    <input type="hidden" name="op" value="modsubscription" />
40
                    <input type="hidden" name="op" value="modsubscription" />
Lines 502-526 fieldset.rows li.radio { width: 100%; } /* override staff-global.css */ Link Here
502
                </div>
508
                </div>
503
            </form>
509
            </form>
504
        </div>
510
        </div>
505
        <div id="mana_search_result" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="width: 100%; left:0%; margin-left: auto; display: none;">
511
506
            <div class="modal-dialog modal-lg">
512
        <!-- Mana Search Result Modal -->
513
        <div class="modal" id="mana_search_result" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label">
514
            <div class="modal-dialog modal-lg" role="document">
507
                <div class="modal-content">
515
                <div class="modal-content">
508
                    <div class="modal-header">
516
                    <div class="modal-header">
509
                        <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
517
                        <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
510
                        <h3 id="mana_search_result_label"></h3>
518
                        <h4 class="modal-title" id="mana_search_result_label">Modal title</h4>
511
                    </div>
519
                    </div>
512
                    <div class="modal-body">
520
                    <div class="modal-body">
513
            </div>
521
                    </div>
514
        </div>
522
                    <div class="modal-footer">
523
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
524
                    </div>
525
                </div>
526
             </div>
527
         </div>
515
528
516
[% MACRO jsinclude BLOCK %]
529
[% MACRO jsinclude BLOCK %]
517
    [% INCLUDE 'calendar.inc' %]
530
    [% INCLUDE 'calendar.inc' %]
518
    [% INCLUDE 'datatables.inc' %]
531
    [% INCLUDE 'datatables.inc' %]
532
    [% Asset.js("js/mana.js") | $raw %]
519
    <script>
533
    <script>
520
        var subscriptionid = "[% subscriptionid | html %]";
534
        var subscriptionid = "[% subscriptionid | html %]";
521
        var irregularity = "[% irregularity | html %]";
535
        var irregularity = "[% irregularity | html %]";
522
        var more_than_one_serial = "[% more_than_one_serial | html %]";
536
        var more_than_one_serial = "[% more_than_one_serial | html %]";
523
        var tags = [];
537
        var tags = [];
538
        var interface = "[% interface | html %]";
539
        var theme = "[% theme | html %]";
524
        [% FOREACH field IN dont_export_field_loop %]
540
        [% FOREACH field IN dont_export_field_loop %]
525
            tags.push("[% field.fieldid | html %]");
541
            tags.push("[% field.fieldid | html %]");
526
        [% END %]
542
        [% END %]
Lines 530-545 fieldset.rows li.radio { width: 100%; } /* override staff-global.css */ Link Here
530
        var MSG_REQUIRED_SUB_LENGTH = _("You must choose a subscription length or an end date.");
546
        var MSG_REQUIRED_SUB_LENGTH = _("You must choose a subscription length or an end date.");
531
        var MSG_TEST_PREDICTION = _("Please click on 'Test prediction pattern' before saving subscription.");
547
        var MSG_TEST_PREDICTION = _("Please click on 'Test prediction pattern' before saving subscription.");
532
        var MSG_REQUIRED_PUB_DATE = _("You must choose a first publication date");
548
        var MSG_REQUIRED_PUB_DATE = _("You must choose a first publication date");
533
        var MSG = _("You have modified the advanced prediction pattern. Please save your work or cancel modifications.");
549
        var MSG_SAVE_PREDICTION_PATTERN = _("You have modified the advanced prediction pattern. Please save your work or cancel modifications.");
534
        var MSG_PATTERN_IRREG = _("Warning! Present pattern has planned irregularities. Click on 'Test prediction pattern' to check if it's still valid")
550
        var MSG_PATTERN_IRREG = _("Warning! Present pattern has planned irregularities. Click on 'Test prediction pattern' to check if it's still valid")
535
        var MSG_PATTERN_NAME = _("Please enter a name for this pattern");
551
        var MSG_PATTERN_NAME = _("Please enter a name for this pattern");
536
        var MSG_PATTERN_NAME_EXISTS = _("This pattern name already exists. Do you want to modify it?");
552
        var MSG_PATTERN_NAME_EXISTS = _("This pattern name already exists. Do you want to modify it?");
537
        var MSG_OVERWRITE_PATTERNS = _("Warning: it will modify the pattern for all subscriptions that are using it.");
553
        var MSG_OVERWRITE_PATTERNS = _("Warning: This will modify the pattern for all subscriptions that are using it.");
538
        var MSG_PATTERN_CREATE_FAILED = _("Something went wrong. Unable to create a new numbering pattern.");
554
        var MSG_PATTERN_CREATE_FAILED = _("Something went wrong. Unable to create a new numbering pattern.");
539
        var MSG_PATTERN_TEST_FAILED = _("Cannot test prediction pattern for the following reason(s): %s");
555
        var MSG_PATTERN_TEST_FAILED = _("Cannot test prediction pattern for the following reason(s): %s");
540
        var MSG_FREQUENCY_UNDEFINED = _("Frequency is not defined");
556
        var MSG_FREQUENCY_UNDEFINED = _("Frequency is not defined");
541
        var MSG_PUB_DATE_UNDEFINED = _("First publication date is not defined");
557
        var MSG_PUB_DATE_UNDEFINED = _("First publication date is not defined");
542
        var MSG_NEXT_ISSUE_UNDEFINED = _("Next issue publication date is not defined");
558
        var MSG_NEXT_ISSUE_UNDEFINED = _("Next issue publication date is not defined");
559
        var MSG_MANA_SEARCHING = _("Searching for subscription in Mana Knowledge Base");
560
        var MSG_MANA_RESULTS = _("Results from Mana Knowledge Base");
561
        var MSG_MANA_SUBSCRIPTION_FOUND = _("Subscription found on Mana Knowledge Base:");
562
        var MSG_MANA_SHOW_DETAILS = _("Show Mana results");
563
        var MSG_MANA_NO_SUBSCRIPTION_FOUND = _("No subscription found on Mana Knowledge Base");
564
        var MSG_MANA_SHARE_PATTERN = _("Please feel free to share your pattern with all others librarians once you are done");
543
    </script>
565
    </script>
544
    [% Asset.js("js/subscription-add.js") | $raw %]
566
    [% Asset.js("js/subscription-add.js") | $raw %]
545
    [% Asset.js("js/showpredictionpattern.js") | $raw %]
567
    [% Asset.js("js/showpredictionpattern.js") | $raw %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (-3 / +9 lines)
Lines 29-34 Link Here
29
            <main>
29
            <main>
30
30
31
    [% INCLUDE 'serials-toolbar.inc' %]
31
    [% INCLUDE 'serials-toolbar.inc' %]
32
    [% INCLUDE 'mana/mana-comment-status.inc' %]
32
33
33
    <h1>Subscription for [% bibliotitle | html %] [% IF closed %](closed)[% END %]</h1>
34
    <h1>Subscription for [% bibliotitle | html %] [% IF closed %](closed)[% END %]</h1>
34
    [% IF ( abouttoexpire ) %]
35
    [% IF ( abouttoexpire ) %]
Lines 475-482 Link Here
475
        var MSG_REOPEN_SUBSCRIPTION = _("Are you sure you want to reopen this subscription?");
476
        var MSG_REOPEN_SUBSCRIPTION = _("Are you sure you want to reopen this subscription?");
476
        var CONFIRM_DELETE_SUBSCRIPTION = _("Are you sure you want to delete this subscription?");
477
        var CONFIRM_DELETE_SUBSCRIPTION = _("Are you sure you want to delete this subscription?");
477
    </script>
478
    </script>
478
    [% INCLUDE 'mana.inc' %]
479
    [% Asset.js("js/serials-toolbar.js") | $raw %]
479
    [% Asset.js("js/serials-toolbar.js") | $raw %]
480
    [% Asset.js("js/mana.js") | $raw %]
480
    [% INCLUDE 'datatables.inc' %]
481
    [% INCLUDE 'datatables.inc' %]
481
    [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %]
482
    [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %]
482
    [% INCLUDE 'columns_settings.inc' %]
483
    [% INCLUDE 'columns_settings.inc' %]
Lines 520-528 Link Here
520
                table.fnFilter( '', 4 ); // Not filter, display all columns
521
                table.fnFilter( '', 4 ); // Not filter, display all columns
521
            });
522
            });
522
            $("#show_all_orders").click();
523
            $("#show_all_orders").click();
523
524
525
        });
524
        });
525
526
        function mana_comment_close(){
527
            $("#selected_id").val("");
528
            $("#mana-resource-id").val("");
529
            $("#mana-comment").val("");
530
            $("#mana-comment-box").modal("hide");
531
        }
526
    </script>
532
    </script>
527
[% END %]
533
[% END %]
528
534
(-)a/koha-tmpl/intranet-tmpl/prog/js/mana.js (+83 lines)
Line 0 Link Here
1
/* global mana_comment_close */
2
3
function mana_increment(mana_id, resource, fieldvalue, stepvalue ) {
4
    $("#mana_comment_progress").show();
5
    if( !stepvalue ){ stepvalue = 1; }
6
    $.ajax({
7
        type: "POST",
8
        url: "/cgi-bin/koha/svc/mana/increment",
9
        data: {id: mana_id, resource: resource, field: fieldvalue, step: stepvalue},
10
        datatype: "json",
11
    })
12
        .done(function() {
13
            $(".mana_comment_status").hide();
14
            $("#mana_comment_success").show();
15
        })
16
        .fail(function( error ) {
17
            $(".mana_comment_status").hide();
18
            $("#mana_comment_errortext").html( error.status + " " + error.statusText );
19
            $("#mana_comment_failed").show();
20
        })
21
        .always(function() {
22
            mana_comment_close();
23
        });
24
}
25
26
function mana_comment( target_id, manamsg, resource_type ) {
27
    $("#mana_comment_progress").show();
28
    $.ajax( {
29
        type: "POST",
30
        url: "/cgi-bin/koha/svc/mana/share",
31
        data: { message: manamsg, resource: resource_type, resource_id: target_id },
32
        datatype: "json",
33
    })
34
        .done(function() {
35
            $(".mana_comment_status").hide();
36
            $("#mana_comment_success").show();
37
        })
38
        .fail(function( error ) {
39
            $(".mana_comment_status").hide();
40
            $("#mana_comment_errortext").html( error.status + " " + error.statusText );
41
            $("#mana_comment_failed").show();
42
        })
43
        .always(function() {
44
            $("#selected_id").val("");
45
            $("#mana-resource-id").val("");
46
            $("#mana-comment").val("");
47
            mana_comment_close();
48
        });
49
}
50
51
$(document).ready(function() {
52
53
    $("body").on("submit", "#mana_comment_form", function( e ) {
54
        e.preventDefault();
55
        var resource_type = $('#mana-resource').val();
56
        var resource_id = $('#mana-resource-id').val();
57
        var comment = $("#mana-comment").val();
58
        mana_comment(resource_id, comment, resource_type);
59
    });
60
61
    $("body").on("click", '#mana-comment-close', function( e ) {
62
        e.preventDefault();
63
        mana_comment_close();
64
    });
65
66
    $("body").on("click", ".mana-actions a", function( e ) {
67
        e.preventDefault();
68
        $(".mana_comment_status").hide();
69
        var commentid = $(this).data("commentid");
70
        var resourceid = $(this).data("resourceid");
71
        $("#mana-resource-id").val( resourceid );
72
        if ( commentid == "other") {
73
            if( $("#new_mana_comment").length ){
74
                $("#selected_id").val( commentid );
75
                $("#mana_results, #new_mana_comment").toggle();
76
            } else {
77
                $("#mana-comment-box").modal("show");
78
            }
79
        } else {
80
            mana_increment( commentid, "resource_comment", "nb");
81
        }
82
    });
83
});
(-)a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js (-111 / +138 lines)
Lines 1-4 Link Here
1
/* global irregularity more_than_one_serial subscriptionid tags */
1
/* global _ irregularity more_than_one_serial subscriptionid tags interface theme mana_enabled MSG_FREQUENCY_LENGTH_ERROR */
2
2
3
var globalnumpatterndata;
3
var globalnumpatterndata;
4
var globalfreqdata;
4
var globalfreqdata;
Lines 47-59 function Clear(id) { Link Here
47
47
48
function Check_page1() {
48
function Check_page1() {
49
    if ( $("#aqbooksellerid").val().length == 0) {
49
    if ( $("#aqbooksellerid").val().length == 0) {
50
        input_box = confirm(_("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"));
50
        input_box = confirm( MSG_LINK_TO_VENDOR );
51
        if (input_box==false) {
51
        if (input_box==false) {
52
            return false;
52
            return false;
53
        }
53
        }
54
    }
54
    }
55
    if ($("#biblionumber").val().length == 0) {
55
    if ($("#biblionumber").val().length == 0) {
56
        alert(_("You must choose or create a biblio"));
56
        alert( MSG_LINK_BIBLIO );
57
        return false;
57
        return false;
58
    }
58
    }
59
59
Lines 63-85 function Check_page1() { Link Here
63
function Check_page2(){
63
function Check_page2(){
64
    if( more_than_one_serial == "" ){
64
    if( more_than_one_serial == "" ){
65
        if($("#acqui_date").val().length == 0){
65
        if($("#acqui_date").val().length == 0){
66
            alert(_("You must choose a first publication date"));
66
            alert( MSG_REQUIRED_PUB_DATE );
67
            return false;
67
            return false;
68
        }
68
        }
69
    }
69
    }
70
    if($("#sublength").val().length == 0 && $("input[name='enddate']").val().length == 0){
70
    if($("#sublength").val().length == 0 && $("input[name='enddate']").val().length == 0){
71
        alert(_("You must choose a subscription length or an end date."));
71
        alert( MSG_REQUIRED_SUB_LENGTH );
72
        return false;
72
        return false;
73
    }
73
    }
74
    if(advancedpatternlocked == 0){
74
    if(advancedpatternlocked == 0){
75
        alert(_("You have modified the advanced prediction pattern. Please save your work or cancel modifications."));
75
        alert( MSG_SAVE_PREDICTION_PATTERN );
76
        return false;
76
        return false;
77
    }
77
    }
78
    if(patternneedtobetested){
78
    if(patternneedtobetested){
79
        if( irregularity !== "" ){
79
        if( irregularity !== "" ){
80
           alert(_("Warning! Present pattern has planned irregularities. Click on 'Test prediction pattern' to check if it's still valid"));
80
            alert( MSG_PATTERN_IRREG );
81
        } else {
81
        } else {
82
            alert(_("Please click on 'Test prediction pattern' before saving subscription."));
82
            alert( MSG_TEST_PREDICTION );
83
        }
83
        }
84
        return false;
84
        return false;
85
    }
85
    }
Lines 95-101 function frequencyload(){ Link Here
95
        $("input[name='unitsperissue']").val(manafreqdata.unitsperissue);
95
        $("input[name='unitsperissue']").val(manafreqdata.unitsperissue);
96
        $("input[name='issuesperunit']").val(manafreqdata.issuesperunit);
96
        $("input[name='issuesperunit']").val(manafreqdata.issuesperunit);
97
        if ($( "#numberpattern option:selected" ).val() === "mana" ) {
97
        if ($( "#numberpattern option:selected" ).val() === "mana" ) {
98
            $("input[name='mana_id']").val(manaid);
98
            $("#mana_id").val(manaid);
99
        }
99
        }
100
    } else {
100
    } else {
101
        $.getJSON("subscription-frequency.pl",{"frequency_id":document.f.frequency.value,ajax:'true'},
101
        $.getJSON("subscription-frequency.pl",{"frequency_id":document.f.frequency.value,ajax:'true'},
Lines 110-116 function frequencyload(){ Link Here
110
                }
110
                }
111
            }
111
            }
112
        );
112
        );
113
        $("input[name='mana_id']").val("");
113
        $("#mana_id").val("");
114
    }
114
    }
115
}
115
}
116
116
Lines 119-125 function numberpatternload(){ Link Here
119
        globalnumpatterndata=mananumpatterndata;
119
        globalnumpatterndata=mananumpatterndata;
120
        $("input[name='sndescription']").val(mananumpatterndata.description);
120
        $("input[name='sndescription']").val(mananumpatterndata.description);
121
        if($("#frequency option:selected" ).val() === "mana"){
121
        if($("#frequency option:selected" ).val() === "mana"){
122
            $("input[name='mana_id']").val(manaid);
122
            $("#mana_id").val(manaid);
123
        }
123
        }
124
        if (globalnumpatterndata==undefined){
124
        if (globalnumpatterndata==undefined){
125
            return false;
125
            return false;
Lines 137-143 function numberpatternload(){ Link Here
137
                restoreAdvancedPattern();
137
                restoreAdvancedPattern();
138
            }
138
            }
139
        );
139
        );
140
        $("input[name='mana_id']").val("");
140
        $("#mana_id").val("");
141
    }
141
    }
142
}
142
}
143
143
Lines 260-283 function testPredictionPattern() { Link Here
260
    var error = 0;
260
    var error = 0;
261
    var error_msg = "";
261
    var error_msg = "";
262
    if(frequencyid == undefined || frequencyid == ""){
262
    if(frequencyid == undefined || frequencyid == ""){
263
        error_msg += _("- Frequency is not defined") + "\n";
263
        error_msg += "- " + MSG_FREQUENCY_UNDEFINED + "\n";
264
        error ++;
264
        error ++;
265
    }
265
    }
266
    acquidate = $("#acqui_date").val();
266
    acquidate = $("#acqui_date").val();
267
    if(acquidate == undefined || acquidate == ""){
267
    if(acquidate == undefined || acquidate == ""){
268
        error_msg += _("- First publication date is not defined") + "\n";
268
        error_msg += "-" + MSG_PUB_DATE_UNDEFINED + "\n";
269
        error ++;
269
        error ++;
270
    }
270
    }
271
    if( more_than_one_serial !== "" ){
271
    if( more_than_one_serial !== "" ){
272
        var nextacquidate = $("#nextacquidate").val();
272
        var nextacquidate = $("#nextacquidate").val();
273
        if(nextacquidate == undefined || nextacquidate == ""){
273
        if(nextacquidate == undefined || nextacquidate == ""){
274
            error_msg += _("- Next issue publication date is not defined") + "\n";
274
            error_msg += "-" + MSG_NEXT_ISSUE_UNDEFINED + "\n";
275
            error ++;
275
            error ++;
276
        }
276
        }
277
    }
277
    }
278
278
279
    if(error){
279
    if(error){
280
        alert(_("Cannot test prediction pattern for the following reason(s): %s").format(error_msg));
280
        alert( MSG_PATTERN_TEST_FAILED.format(error_msg) );
281
        return false;
281
        return false;
282
    }
282
    }
283
283
Lines 326-332 function testPredictionPattern() { Link Here
326
326
327
function saveAdvancedPattern() {
327
function saveAdvancedPattern() {
328
    if ($("#patternname").val().length == 0) {
328
    if ($("#patternname").val().length == 0) {
329
        alert(_("Please enter a name for this pattern"));
329
        alert( MSG_PATTERN_NAME );
330
        return false;
330
        return false;
331
    }
331
    }
332
332
Lines 341-348 function saveAdvancedPattern() { Link Here
341
    });
341
    });
342
    var cnfrm = 1;
342
    var cnfrm = 1;
343
    if(found){
343
    if(found){
344
        var msg = _("This pattern name already exists. Do you want to modify it?")
344
        var msg = MSG_PATTERN_NAME_EXISTS
345
            + "\n" + _("Warning: it will modify the pattern for all subscriptions that are using it.");
345
            + "\n" + MSG_OVERWRITE_PATTERNS;
346
        cnfrm = confirm(msg);
346
        cnfrm = confirm(msg);
347
    }
347
    }
348
348
Lines 372-378 function saveAdvancedPattern() { Link Here
372
                    $("#numberpattern").val(data.numberpatternid);
372
                    $("#numberpattern").val(data.numberpatternid);
373
                    numberpatternload();
373
                    numberpatternload();
374
                } else {
374
                } else {
375
                    alert(_("Something went wrong. Unable to create a new numbering pattern."));
375
                    alert( MSG_PATTERN_CREATE_FAILED );
376
                }
376
                }
377
            }
377
            }
378
        );
378
        );
Lines 393-399 function show_page_2() { Link Here
393
}
393
}
394
394
395
function mana_search() {
395
function mana_search() {
396
    $("#mana_search").html("<p>" + _("Mana kb is being asked for your subscription..") + "</p>");
396
    $("#mana_search").html("<p>" + MSG_MANA_SEARCHING + "... <img src='" + interface + "/" + theme + "/img/spinner-small.gif' /></p>");
397
    $("#mana_search").show();
397
    $("#mana_search").show();
398
398
399
    $.ajax({
399
    $.ajax({
Lines 402-434 function mana_search() { Link Here
402
        data: {id: $("#biblionumber").val(), resource: 'subscription', usecomments: 1},
402
        data: {id: $("#biblionumber").val(), resource: 'subscription', usecomments: 1},
403
        dataType: "html",
403
        dataType: "html",
404
    })
404
    })
405
    .done( function( result ) {
405
        .done( function( result ) {
406
        $("#mana_search_result .modal-body").html(result);
406
            $("#mana_search_result .modal-body").html(result);
407
        $("#mana_search_result_label").text(_("Results from Mana Knowledge Base"));
407
            $("#mana_search_result_label").text( MSG_MANA_RESULTS );
408
        $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults, {
408
            $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults, {
409
            "sPaginationType": "four_button",
409
                "sPaginationType": "four_button",
410
            "order":[[4, "desc"], [5, "desc"]],
410
                "order":[[4, "desc"], [5, "desc"]],
411
            "autoWidth": false,
411
                "autoWidth": false,
412
            "columnDefs": [
412
                "columnDefs": [
413
                { "width": "35%", "targets": 1 }
413
                    { "width": "35%", "targets": 1 }
414
            ],
414
                ],
415
            "aoColumnDefs": [
415
                "aoColumnDefs": [
416
                { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
416
                    { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
417
                { "sType": "title-string", "aTargets" : [ "title-string" ] },
417
                    { "sType": "title-string", "aTargets" : [ "title-string" ] },
418
                { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
418
                    { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
419
            ]
419
                ]
420
        }));
420
            }));
421
        if( $("#mana_results_datatable").length && $("td.dataTables_empty").length == 0){
421
            if( $("#mana_results_datatable").length && $("td.dataTables_empty").length == 0){
422
            $("#mana_search").html("<p>" + _("Subscription found on Mana Knowledge Base:") + "</p><p> <a style='cursor:pointer' data-toggle='modal' data-target='#mana_search_result'>" + _("Quick fill") + "</a></p>");
422
                $("#mana_search").html("<p>" + MSG_MANA_SUBSCRIPTION_FOUND + "</p><p> <a href=\"#\" data-toggle=\"modal\" data-target=\"#mana_search_result\"><i class=\"fa fa-window-maximize\"></i> " + MSG_MANA_SHOW_DETAILS + "</a></p>");
423
        }
423
            }
424
        else if ( $("#mana_results_datatable").length ){
424
            else if ( $("#mana_results_datatable").length ){
425
            $("#mana_search").html("<p>" + _("No subscription found on Mana Knowledge Base :(") + "</p><p>" + _(" Please feel free to share you pattern with all others librarians once you are done") + "</p>");
425
                $("#mana_search").html("<p>" + MSG_MANA_NO_SUBSCRIPTION_FOUND + "</p><p>" + MSG_MANA_SHARE_PATTERN + "</p>");
426
        }
426
            }
427
        else{
427
            else{
428
            $("#mana_search").html( result );
428
                $("#mana_search").html( result );
429
        }
429
            }
430
        $("#mana_search").show();
430
            $("#mana_search").show();
431
    })
431
        });
432
}
432
}
433
433
434
function mana_use(mana_id){
434
function mana_use(mana_id){
Lines 440-509 function mana_use(mana_id){ Link Here
440
        data: {id: mana_id, resource: 'subscription'},
440
        data: {id: mana_id, resource: 'subscription'},
441
        dataType: "json",
441
        dataType: "json",
442
    })
442
    })
443
    .done(function(result){
443
        .done(function(result){
444
        var select = document.getElementById('numberpattern');
444
            var select = document.getElementById('numberpattern');
445
        for(i = 0; i < select.length; i++){
445
            for(i = 0; i < select.length; i++){
446
            if(select[i].value === "mana"){
446
                if(select[i].value === "mana"){
447
                select.remove(i);
447
                    select.remove(i);
448
                }
448
            }
449
            }
449
        }
450
            var optionnumpattern = document.createElement("option");
450
        var optionnumpattern = document.createElement("option");
451
            optionnumpattern.text = result.label + " (mana)";
451
        optionnumpattern.text = result.label + " (mana)";
452
            optionnumpattern.selected = true;
452
        optionnumpattern.selected = true;
453
            optionnumpattern.value="mana";
453
        optionnumpattern.value="mana";
454
            select.add(optionnumpattern);
454
        select.add(optionnumpattern);
455
455
456
            mananumpatterndata = {
456
        mananumpatterndata = {
457
                id:"mana",
457
            id:"mana",
458
                add1:result.add1,
458
            add1:result.add1,
459
                add2:result.add2,
459
            add2:result.add2,
460
                add3:result.add3,
460
            add3:result.add3,
461
                description:result.sndescription,
461
            description:result.sndescription,
462
                displayorder:result.displayorder,
462
            displayorder:result.displayorder,
463
                every1:result.every1,
463
            every1:result.every1,
464
                every2:result.every2,
464
            every2:result.every2,
465
                every3:result.every3,
465
            every3:result.every3,
466
                label:result.label,
466
            label:result.label,
467
                label1:result.label1,
467
            label1:result.label1,
468
                label2:result.label2,
468
            label2:result.label2,
469
                label3:result.label3,
469
            label3:result.label3,
470
                numbering1:result.numbering1,
470
            numbering1:result.numbering1,
471
                numbering2:result.numbering2,
471
            numbering2:result.numbering2,
472
                numbering3:result.numbering3,
472
            numbering3:result.numbering3,
473
                numberingmethod:result.numberingmethod,
473
            numberingmethod:result.numberingmethod,
474
                setto1:result.setto1,
474
            setto1:result.setto1,
475
                setto2:result.setto2,
475
            setto2:result.setto2,
476
                setto3:result.setto3,
476
            setto3:result.setto3,
477
                whenmorethan1:result.whenmorethan1,
477
            whenmorethan1:result.whenmorethan1,
478
                whenmorethan2:result.whenmorethan2,
478
            whenmorethan2:result.whenmorethan2,
479
                whenmorethan3:result.whenmorethan3,
479
            whenmorethan3:result.whenmorethan3,
480
            };
480
        };
481
            select = document.getElementById("frequency");
481
        select = document.getElementById("frequency");
482
            for(i = 0; i < select.length; i++){
482
        for(i = 0; i < select.length; i++){
483
                if(select[i].value === "mana"){
483
            if(select[i].value === "mana"){
484
                    select.remove(i);
484
                select.remove(i);
485
                }
485
            }
486
            }
486
        }
487
            var optionfreq = document.createElement("option");
487
        var optionfreq = document.createElement("option");
488
            optionfreq.text = result.sfdescription + " (mana)";
488
        optionfreq.text = result.sfdescription + " (mana)";
489
            optionfreq.selected = true;
489
        optionfreq.selected = true;
490
            optionfreq.value="mana";
490
        optionfreq.value="mana";
491
            select.add(optionfreq);
491
        select.add(optionfreq);
492
            manafreqdata = {
492
        manafreqdata = {
493
                id:"mana",
493
            id:"mana",
494
                description:result.sfdescription,
494
            description:result.sfdescription,
495
                displayorder:result.displayorder,
495
            displayorder:result.displayorder,
496
                issuesperunit:result.issuesperunit,
496
            issuesperunit:result.issuesperunit,
497
                unit:result.unit,
497
            unit:result.unit,
498
                unitsperissue:result.unitsperissue,
498
            unitsperissue:result.unitsperissue,
499
            };
499
        };
500
            manaid = result.id;
500
        manaid = result.id;
501
            $("#mana_id").val(manaid);
501
        $("input[name='mana_id']").val(manaid);
502
            $("#mana_search_result").modal("hide");
502
        $("#mana_search_result").modal("hide");
503
            frequencyload();
503
        frequencyload();
504
            numberpatternload();
504
        numberpatternload();
505
        })
505
    }).fail( function( result ){
506
        .done( function(){
506
    });
507
            $("tr").removeClass("selected");
508
            $(".mana-use i").attr("class","fa fa-download");
509
        })
510
        .fail( function( result ){
511
        });
512
}
513
514
function mana_comment_close(){
515
    $("#selected_id").val("");
516
    $("#mana-resource-id").val("");
517
    $("#mana-comment").val("");
518
    $("#mana_results").show();
519
    $("#new_mana_comment").hide();
507
}
520
}
508
521
509
$(document).ready(function() {
522
$(document).ready(function() {
Lines 511-517 $(document).ready(function() { Link Here
511
        mana_search();
524
        mana_search();
512
    }
525
    }
513
    $("#displayexample").hide();
526
    $("#displayexample").hide();
514
    $("#mana_search_result").modal("hide");
527
528
    // When Mana search results modal is hidden, hide comment form and any status messages
529
    $("#mana_search_result").on("hide.bs.modal", function(){
530
        $("#mana_results").show();
531
        $("#new_mana_comment").hide();
532
        $(".mana_comment_status").hide();
533
    });
534
515
    $("#aqbooksellerid").on('keypress', function(e) {
535
    $("#aqbooksellerid").on('keypress', function(e) {
516
        if (e.keyCode == 13) {
536
        if (e.keyCode == 13) {
517
            e.preventDefault();
537
            e.preventDefault();
Lines 652-655 $(document).ready(function() { Link Here
652
    $('#save-subscription').on("click", function(e){
672
    $('#save-subscription').on("click", function(e){
653
        $('select:disabled').removeAttr('disabled');
673
        $('select:disabled').removeAttr('disabled');
654
    });
674
    });
675
676
    $("body").on("click", ".mana-use", function(e) {
677
        e.preventDefault();
678
        $(this).find("i").attr("class","fa fa-refresh fa-spin");
679
        var subscription_id = $(this).data("subscription_id");
680
        mana_use( subscription_id );
681
    });
655
});
682
});
(-)a/svc/mana/search (-4 / +2 lines)
Lines 23-32 use Modern::Perl; Link Here
23
use Koha::SharedContent;
23
use Koha::SharedContent;
24
use Koha::Subscription;
24
use Koha::Subscription;
25
use C4::Auth qw(check_cookie_auth), qw(get_template_and_user);
25
use C4::Auth qw(check_cookie_auth), qw(get_template_and_user);
26
use C4::Output qw( output_with_http_headers );
26
use C4::Output qw( output_html_with_http_headers );
27
27
28
use CGI;
28
use CGI;
29
use JSON;
30
29
31
my $input = new CGI;
30
my $input = new CGI;
32
31
Lines 80-83 $template->param( $input->param('resource')."s" => $result->{data} ); Link Here
80
$template->param( statuscode => $result->{code} );
79
$template->param( statuscode => $result->{code} );
81
$template->param( msg => $result->{msg} );
80
$template->param( msg => $result->{msg} );
82
81
83
output_with_http_headers $input, $cookie, $template->output, 'json';
82
output_html_with_http_headers $input, $cookie, $template->output;
84
- 

Return to bug 22250