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 7-19 Link Here
7
            [% ELSE %]
7
            [% ELSE %]
8
                <div class="btn-group"><a id="newsubscription" class="btn btn-default btn-sm" href="/cgi-bin/koha/serials/subscription-add.pl"><i class="fa fa-plus"></i> New subscription</a></div>
8
                <div class="btn-group"><a id="newsubscription" class="btn btn-default btn-sm" href="/cgi-bin/koha/serials/subscription-add.pl"><i class="fa fa-plus"></i> New subscription</a></div>
9
            [% END %]
9
            [% END %]
10
            [% IF Koha.Preference('Mana') == 1 and Koha.Preference('AutoShareWithMana').grep('subscription').size == 0 %]
11
                [% IF one_language_enabled==0 or mana_id %]
12
                    <div class="btn-group"><a data-toggle="modal" data-toggle="tooltip" title="Share the subscription with other librairies. Your email address will be associated to your sharing." data-target="#mana_share_modal" class="btn btn-default btn-sm"><i class="fa fa-share-alt"></i> Share</a></div>
13
                [% ELSE %]
14
                    <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>
15
                [% END %]
16
            [% END %]
17
        [% END %]
10
        [% END %]
18
11
19
        [% IF ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription ) %]
12
        [% IF ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription ) %]
Lines 61-98 Link Here
61
            [% END %]
54
            [% END %]
62
        [% END %]
55
        [% END %]
63
56
57
        [% IF Koha.Preference('Mana') == 1 and Koha.Preference('AutoShareWithMana').grep('subscription').size == 0 %]
58
            [% IF one_language_enabled==0 or mana_id %]
59
                <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>
60
            [% ELSE %]
61
                <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>
62
            [% END %]
63
        [% END %]
64
64
        [% IF ( mana_id && Koha.Preference('Mana') == 1 ) %]
65
        [% IF ( mana_id && Koha.Preference('Mana') == 1 ) %]
65
            <div class="btn-group">
66
            <div class="btn-group">
66
                <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"> Report mistake <span class="caret"></span></button>
67
                <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"> Report mistake <span class="caret"></span></button>
67
                <ul class="dropdown-menu">
68
                <ul class="dropdown-menu mana-actions">
68
                    [% FOREACH c IN mana_comments %]
69
                    [% IF ( mana_comments ) %]
69
                        <li class="mana-comment" data-id="[% c.id | $raw %]">
70
                        [% FOREACH c IN mana_comments %]
70
                            <a href="#">[% c.message | html %] ([% c.nb | html %])</a>
71
                            <li>
71
                        </li>
72
                                <a data-commentid="[% c.id | html %]" data-resourceid="[% mana_id | html %]" href="#">[% c.message | html %] ([% c.nb | html %])</a>
73
                            </li>
74
                        [% END %]
75
                        <li role="separator" class="divider"></li>
72
                    [% END %]
76
                    [% END %]
73
                    <li role="separator" class="divider"></li>
77
                    <li><a data-commentid="other" data-resourceid="[% mana_id | html %]" href="#">New comment</a></li>
74
                    <li class="mana-other-comment"><a href="#">Other</a> </li>
75
                </ul>
78
                </ul>
76
            </div>
79
            </div>
77
78
            <div id="mana-comment-box" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="display: none;">
79
                <div class="modal-dialog modal-lg" style="width: 30%">
80
                    <div class="modal-content" style="">
81
                        <div class="modal-header">
82
                            <button type="button" id="mana-comment-close" class="closebtn"  aria-hidden="true">×</button>
83
                            <h3 id="mana_submit_comment"> Please enter a new commment (max 35 caracters)</h3>
84
                        </div>
85
                        <div class="modal-body">
86
                            <input hidden id="mana-resource" value="subscription">
87
                            <input hidden id="mana-resource-id" value="[% mana_id | $raw %]">
88
                            <div>
89
                                <input type="text" maxlength="35" size="35" id="mana-comment">
90
                            </div>
91
                            <button id="mana-send-comment"> Comment </button>
92
                        </div>
93
                    </div>
94
                </div>
95
            </div>
96
        [% END %]
80
        [% END %]
97
    </div>
81
    </div>
98
[% ELSIF CAN_user_serials_create_subscription %]
82
[% ELSIF CAN_user_serials_create_subscription %]
Lines 105-126 Link Here
105
    </div>
89
    </div>
106
[% END %]
90
[% END %]
107
91
108
<div id="mana_share_modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mana_share_modal_label" style="display: none;">
92
<div class="modal" id="mana-comment-box" tabindex="-1" role="dialog" aria-labelledby="mana_submit_comment">
109
    <div class="modal-dialog">
93
    <div class="modal-dialog" role="document">
94
        <div class="modal-content">
95
            <form id="mana_comment_form" action="/cgi-bin/koha/serials/subscription-detail.pl" method="get">
96
                <div class="modal-header">
97
                    <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
98
                    <h4 class="modal-title" id="mana_submit_comment">Please enter a new comment (max 35 characters)</h4>
99
                </div>
100
                <div class="modal-body">
101
                    <input type="hidden" id="mana-resource" value="subscription" />
102
                    <input type="hidden" id="mana-resource-id" value="[% mana_id | html %]" />
103
                    <input type="text" maxlength="35" size="35" id="mana-comment" required="required" />
104
                    <button id="mana-send-comment">Submit</button>
105
                    <a href="#" class="cancel" id="mana-comment-close">Cancel</a>
106
                </div>
107
                <div class="modal-footer">
108
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
109
                </div>
110
            </form>
111
        </div> <!-- /.modal-content -->
112
    </div> <!-- /.modal-dialog -->
113
</div> <!-- /#mana-comment-box -->
114
115
<div id="mana_share_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_share_modal_label">
116
    <div class="modal-dialog" role="document">
110
        <div class="modal-content">
117
        <div class="modal-content">
111
            <div class="modal-header">
118
            <div class="modal-header">
112
                <h3 id="mana_share_modal_label">Share [% bibliotitle | html %] to Mana</h3>
119
                <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
120
                <h4 id="mana_share_modal_label">Share [% bibliotitle | html %] to Mana</h4>
113
            </div>
121
            </div>
114
            <div class="modal-body">
122
            <div class="modal-body">
115
                [% IF (mana_id) %]
123
                [% IF (mana_id) %]
116
                    <div class="alert">
124
                    <div class="alert">
117
<h1>[% mana_id | $raw %]</h1>
118
                        <p>Your subscription is already linked with a Mana subscription model. Share it if you have made modifications, otherwise it will do nothing.</p>
125
                        <p>Your subscription is already linked with a Mana subscription model. Share it if you have made modifications, otherwise it will do nothing.</p>
119
                    </div>
126
                    </div>
120
                [% END %]
127
                [% END %]
121
                [% IF ( languages_loop ) %]
128
                [% IF ( languages_loop ) %]
122
                    [% UNLESS ( one_language_enabled ) %]
129
                    [% UNLESS ( one_language_enabled ) %]
123
                        <div class="rows">
130
                        <div class="rows">
131
                            <ol>
124
                                <li><span class="label">Frequency: </span>
132
                                <li><span class="label">Frequency: </span>
125
                                        [% frequency.description | html %]
133
                                        [% frequency.description | html %]
126
                                </li>
134
                                </li>
Lines 183-203 Link Here
183
                                        [% END %]
191
                                        [% END %]
184
                                    </select>
192
                                    </select>
185
                                    <input type="hidden" id="op" name="op" value="share"/>
193
                                    <input type="hidden" id="op" name="op" value="share"/>
186
                                    <input type="hidden" id="subscriptionid" name="subscriptionid" value="[% subscriptionid | $raw %]"/>
194
                                    <input type="hidden" id="subscriptionid" name="subscriptionid" value="[% subscriptionid | html %]"/>
187
                                </fieldset>
195
                                </fieldset>
188
                            </form>
196
                            </form>
189
                        </div>
197
                        </div> <!-- /.rows -->
190
                    [% END %]
198
                    [% END %]
191
                [% END %]
199
                [% END %]
192
            </div>
200
            </div> <!-- /.modal-body -->
193
            <div class="modal-footer">
201
            <div class="modal-footer">
194
                <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
202
                <button type="submit" form="mana_share_form" class="btn btn-default">Share</button>
195
                [% IF one_language_enabled==0 %]
203
                <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>
196
                    <button type="submit" form="mana_share_form" class="btn btn-primary">Share</button>
197
                [% ELSE %]
198
                    <div class="btn-group" id="mana-subscription-share"><a class="btn btn-primary">Share</a></div>
199
                [% END %]
200
            </div>
204
            </div>
201
        </div>
205
        </div> <!-- /.modal-content -->
202
    </div>
206
    </div> <!-- /.modal-dialog -->
203
</div>
207
</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 (-120 / +97 lines)
Lines 39-49 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
[% IF ( saved1 ) %]
45
[% Asset.css("css/datatables.css") | $raw %]
45
    [% Asset.css("css/datatables.css") | $raw %]
46
[% END %]
47
[% Asset.css("lib/d3c3/c3.min.css") | $raw %]
46
[% Asset.css("lib/d3c3/c3.min.css") | $raw %]
48
</head>
47
</head>
49
48
Lines 176-189 canned reports and writing custom SQL reports.</p> Link Here
176
                <option value="">All</option>
175
                <option value="">All</option>
177
            </select>
176
            </select>
178
        </div>
177
        </div>
179
<div style="display:inline-block">
180
    [% IF manamsg %]
181
     <div id="mana_search" class="dialog message">
182
        <p> [% manamsg | html %] </p>
183
    </div>
184
    [% END %]
185
178
186
</script>
179
        [% IF (Koha.Preference('Mana') == 1) %]
180
            [% IF manamsg %]
181
                <div id="mana_search_message" class="dialog message">
182
                    <p> [% manamsg | html %] </p>
183
                </div>
184
            [% END %]
185
        [% END %]
187
186
188
<form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
187
<form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
189
<input type="hidden" name="phase" value="Delete Multiple" />
188
<input type="hidden" name="phase" value="Delete Multiple" />
Lines 224-230 canned reports and writing custom SQL reports.</p> Link Here
224
                            [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
223
                            [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
225
                                <input type="checkbox" name="ids" value="[% savedreport.id | html %]" />
224
                                <input type="checkbox" name="ids" value="[% savedreport.id | html %]" />
226
                            [% END %]
225
                            [% END %]
227
                        <input hidden class="report_sql" value="[% savedreport.savedsql |html %]">
226
                            <input type="hidden" class="report_sql" value="[% savedreport.savedsql |html %]">
228
                        </td>
227
                        </td>
229
                        <td class="report_id"><label for="ids">[% savedreport.id | html %]</label></td>
228
                        <td class="report_id"><label for="ids">[% savedreport.id | html %]</label></td>
230
                        <td class="report_name">
229
                        <td class="report_name">
Lines 299-305 canned reports and writing custom SQL reports.</p> Link Here
299
                [% END %]
298
                [% END %]
300
            </tbody>
299
            </tbody>
301
        </table>
300
        </table>
302
</div>
301
303
        [% IF ( CAN_user_reports_delete_reports ) %]
302
        [% IF ( CAN_user_reports_delete_reports ) %]
304
        <fieldset class="action">
303
        <fieldset class="action">
305
            <input type="submit" value="Delete selected" />
304
            <input type="submit" value="Delete selected" />
Lines 340-445 canned reports and writing custom SQL reports.</p> Link Here
340
[% END %]
339
[% END %]
341
[% END %]
340
[% END %]
342
341
343
<div id="mana_share_report" class="modal fade" tabindex="-1" role="dialog" arialabelledby="mana_share_modal_label" style="display: none;">
342
[% INCLUDE 'mana/mana-share-report.inc' %]
344
    <div class="modal-dialog">
345
        <div class="modal-content">
346
            <div class="modal-header">
347
                <h3 id="mana_share_modal_label">Share with Mana</h3>
348
            </div>
349
            <div class="modal-body">
350
                [% IF (mana_id) %]
351
                    <div class="alert">
352
                        <p>Your subscription is already linked with a Mana subscription model. Share it if you have made modifications, otherwise it will do nothing.</p>
353
                    </div>
354
                [% END %]
355
                <div id="note-error" class="alert alert-danger" role="alert">
356
                    Please enter a report name and descriptive note before sharing (minimum 20 characters)
357
                </div>
358
                <div class="shared_infos rows">
359
                    <li><span class="label">Id: </span><div id="shared_id"></div></li>
360
                    <li><span class="label">Name: </span><div id="shared_name"></div></li>
361
                    <li><span class="label">SQL: </span><div id="shared_sql"></div></li>
362
                    <li><span class="label">Group: </span><div id="shared_group"></div></li>
363
                    <li><span class="label">Type: </span><div id="shared_type"></div></li>
364
                    <li><span class="label">Notes: </span><div id="shared_notes"></div></li>
365
                </div>
366
                <div class="rows">
367
                    <form method="post" id="mana_share_form" action="/cgi-bin/koha/reports/guided_reports.pl" class="validated" >
368
                        <input type="hidden" name="phase" value="Share">
369
370
                        [% IF (languages_loop) %]
371
                            <fieldset class="shared_infos">
372
                                <label for="mana_language">Language:</label>
373
                                <select id="mana_language" name="mana_language">
374
                                    [% FOREACH languages_loo IN languages_loop %]
375
                                        [% IF ( languages_loo.group_enabled ) %]
376
                                            [% IF ( languages_loo.plural ) %]
377
                                                [% FOREACH sublanguages_loo IN languages_loo.sublanguages_loop %]
378
                                                    [% IF ( sublanguages_loo.enabled ) %]
379
                                                        [% IF ( sublanguages_loo.sublanguage_current ) %]
380
                                                            <option value="[% languages_loo.rfc4646_subtag | html %]" selected>
381
                                                                [% sublanguages_loo.native_description | html %]
382
                                                                [% sublanguages_loo.script_description | html %]
383
                                                                [% sublanguages_loo.region_description | html %]
384
385
                                                                [% sublanguages_loo.variant_description | html %]
386
                                                                ([% sublanguages_loo.rfc4646_subtag | html %])
387
                                                            </option>
388
                                                        [% ELSE %]
389
                                                            <option value="[% languages_loo.rfc4646_subtag | html %]">
390
                                                                [% sublanguages_loo.native_description | html %]
391
                                                                [% sublanguages_loo.script_description | html %]
392
                                                                [% sublanguages_loo.region_description | html %]
393
                                                                [% sublanguages_loo.variant_description | html %]
394
                                                                ([% sublanguages_loo.rfc4646_subtag | html %])
395
                                                            </option>
396
                                                        [% END %]
397
                                                    [% END %]
398
                                                [% END %]
399
                                            [% ELSE %]
400
                                                [% IF ( languages_loo.group_enabled ) %]
401
                                                    [% IF ( languages_loo.current ) %]
402
                                                        <option value="[% languages_loo.rfc4646_subtag | html %]" selected>
403
                                                            [% IF ( languages_loo.native_description ) %]
404
                                                                [% languages_loo.native_description | html %]
405
                                                            [% ELSE %]
406
                                                                [% languages_loo.rfc4646_subtag | html %]
407
                                                            [% END %]
408
                                                        </option>
409
                                                    [% ELSE %]
410
                                                        <option value="[% languages_loo.rfc4646_subtag | html %]">
411
                                                            [% IF ( languages_loo.native_description ) %]
412
                                                                [% languages_loo.native_description | html %]
413
                                                            [% ELSE %]
414
                                                                [% languages_loo.rfc4646_subtag | html %]
415
                                                            [% END %]
416
                                                        </option>
417
                                                    [% END %]
418
                                                [% END %]
419
                                            [% END %]
420
                                        [% END %]
421
                                    [% END %]
422
                                </select>
423
                            </fieldset>
424
                        [% ELSE %]
425
                            <input type="hidden" name="mana_language" value="[% lang | html %]">
426
                        [% END %]
427
                        <input type="hidden" id="reportid" name="reportid"/>
428
                    </form>
429
                </div>
430
            </div>
431
            <div class="modal-footer">
432
                <button class="btn" id="ManaCloseButton" data-dismiss="modal" aria-hidden="true">Close</button>
433
                [% IF one_language_enabled==0 %]
434
                    <button id="ManaShareButton" type="submit" form="mana_share_form" class="btn btn-primary shared_infos">Share</button>
435
                [% ELSE %]
436
                    <div id="ManaShareButton" class="btn-group"><a class="btn btn-primary shared_infos">Share</a></div>
437
                [% END %]
438
            </div>
439
        </div>
440
    </div>
441
</div>
442
443
343
444
[% IF ( build1 ) %]
344
[% IF ( build1 ) %]
445
[% IF ( cache_error) %]
345
[% IF ( cache_error) %]
Lines 1061-1067 canned reports and writing custom SQL reports.</p> Link Here
1061
[% END %]
961
[% END %]
1062
962
1063
963
1064
[% INCLUDE 'guided-reports-view.inc' %]
964
                [% INCLUDE 'guided-reports-view.inc' %]
1065
            </aside>
965
            </aside>
1066
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
966
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1067
     </div> <!-- /.row -->
967
     </div> <!-- /.row -->
Lines 1072-1084 canned reports and writing custom SQL reports.</p> Link Here
1072
    [% Asset.js("lib/d3c3/d3.min.js") | $raw %]
972
    [% Asset.js("lib/d3c3/d3.min.js") | $raw %]
1073
    [% Asset.js("lib/d3c3/c3.min.js") | $raw %]
973
    [% Asset.js("lib/d3c3/c3.min.js") | $raw %]
1074
    [% INCLUDE 'calendar.inc' %]
974
    [% INCLUDE 'calendar.inc' %]
1075
    [% INCLUDE 'mana.inc' %]
975
    [% INCLUDE 'datatables.inc' %]
1076
    [% IF ( saved1 ) %]
976
    [% IF ( saved1 ) %]
1077
        [% INCLUDE 'datatables.inc' %]
1078
        [% INCLUDE 'columns_settings.inc' %]
977
        [% INCLUDE 'columns_settings.inc' %]
1079
    [% END %]
978
    [% END %]
1080
    [% Asset.js( "lib/codemirror/codemirror-compressed.js" ) | $raw %]
979
    [% Asset.js( "lib/codemirror/codemirror-compressed.js" ) | $raw %]
1081
    [% Asset.js( "lib/codemirror/sql.min.js" ) | $raw %]
980
    [% Asset.js( "lib/codemirror/sql.min.js" ) | $raw %]
981
    [% Asset.js( "js/mana.js" ) | $raw %]
1082
    <script>
982
    <script>
1083
983
1084
        function hide_bar_element() {
984
        function hide_bar_element() {
Lines 1276-1282 canned reports and writing custom SQL reports.</p> Link Here
1276
                window.history.back();
1176
                window.history.back();
1277
            });
1177
            });
1278
1178
1279
            $(".mana_search_button").on("click",function(){
1179
            $("body").on("click", ".mana_search_button", function(){
1180
                $("#mana-loading").show();
1280
                mana_search($("#mana_search_field").val());
1181
                mana_search($("#mana_search_field").val());
1281
            });
1182
            });
1282
1183
Lines 1490-1499 canned reports and writing custom SQL reports.</p> Link Here
1490
                return confirmDelete(MSG_CONFIRM_DELETE);
1391
                return confirmDelete(MSG_CONFIRM_DELETE);
1491
            });
1392
            });
1492
1393
1493
            $('div#ManaShareButton').click(function() {
1494
                $("#mana_share_form").submit();
1495
            });
1496
1497
            $("#mana_search_form").submit(function(e){
1394
            $("#mana_search_form").submit(function(e){
1498
                e.preventDefault();
1395
                e.preventDefault();
1499
            });
1396
            });
Lines 1506-1511 canned reports and writing custom SQL reports.</p> Link Here
1506
                $("#selectedColumns option").attr("selected", "selected");  // Select everything still in #selectedColumns
1403
                $("#selectedColumns option").attr("selected", "selected");  // Select everything still in #selectedColumns
1507
                return true;
1404
                return true;
1508
            });
1405
            });
1406
1407
            // Mana KB
1408
            $("body").on("click", ".mana-use", function(e) {
1409
                e.preventDefault();
1410
                $(this).find("i").attr("class","fa fa-refresh fa-spin");
1411
                mana_use( $(this).data("report_id") );
1412
            });
1413
1414
            $("#mana_search_result").on("hide.bs.modal", function(){
1415
                $("#mana_result_content").html("");
1416
                $("#mana_search_field").val("");
1417
            });
1509
        });
1418
        });
1510
1419
1511
        function addColumn() {
1420
        function addColumn() {
Lines 1514-1519 canned reports and writing custom SQL reports.</p> Link Here
1514
        function delColumn() {
1423
        function delColumn() {
1515
            $("#selectedColumns option:selected").remove();
1424
            $("#selectedColumns option:selected").remove();
1516
        }
1425
        }
1426
1427
        // Mana KB
1428
        function mana_use( mana_id ){
1429
            $.ajax( {
1430
                type:"POST",
1431
                url: "/cgi-bin/koha/svc/mana/use",
1432
                data: {id:mana_id, resource: 'report', saveinbase: 1},
1433
                dataType: "json",
1434
            })
1435
            .done( function (result){
1436
                if ( result.errmsg ){
1437
                    alert( result.errmsg );
1438
                }
1439
                else{
1440
                    window.location = ("/cgi-bin/koha/reports/guided_reports.pl?reports=").concat(result.id).concat("&phase=Show%20SQL&mana_success=1");
1441
                }
1442
            })
1443
            .fail(function( error ) {
1444
                $(".mana_use_status").hide();
1445
                $("#mana_use_errortext").html( error.status + " " + error.statusText );
1446
                $("#mana_use_failed").show();
1447
                $(".mana-use i").attr("class","fa fa-download");
1448
            });
1449
        }
1450
1451
        function mana_search( textquery ){
1452
            $(".mana_search_status").hide();
1453
            $("#mana_result_content").load("/cgi-bin/koha/svc/mana/search #mana_results", { resource: 'report', id: textquery, usecomments: 1 }, function( response, status, xhr ) {
1454
1455
                    if ( status == "error" ) {
1456
                        $("#mana_search_errortext").html( xhr.status + " " + xhr.statusText );
1457
                        $("#mana_search_failed").show();
1458
                        $("#mana-loading").hide();
1459
                    } else {
1460
                        $(".mana_search_status").hide();
1461
                        $("#mana_search_result_label").text(_("Results from Mana Knowledge Base"));
1462
                        $("#mana-loading").hide();
1463
                        $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults,{
1464
                            "sPaginationType":"four_button",
1465
                            "autoWidth": false,
1466
                            "columnDefs": [
1467
                                { "width": "35%", "targets": 1 }
1468
                            ],
1469
                            "aoColumnDefs": [
1470
                                { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
1471
                                { "sType": "title-string", "aTargets" : [ "title-string" ] },
1472
                                { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
1473
                            ]
1474
                        }));
1475
1476
                        $(".showbutton").on("click", function(e){
1477
                            e.preventDefault();
1478
                            $(this).parent().hide();
1479
                            $(this).parent().next().show();
1480
                        });
1481
1482
                        $(".hidebutton").on("click", function(e){
1483
                            e.preventDefault();
1484
                            $(this).parent().hide();
1485
                            $(this).parent().prev().show();
1486
                        });
1487
1488
                        if($("td.dataTables_empty").length == 0){
1489
                            $("#mana_search_message").show();
1490
                        }
1491
                    }
1492
                });
1493
        }
1517
    </script>
1494
    </script>
1518
[% END %]
1495
[% END %]
1519
1496
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt (-1 lines)
Lines 421-427 Link Here
421
[% MACRO jsinclude BLOCK %]
421
[% MACRO jsinclude BLOCK %]
422
    [% INCLUDE 'calendar.inc' %]
422
    [% INCLUDE 'calendar.inc' %]
423
    [% INCLUDE 'datatables.inc' %]
423
    [% INCLUDE 'datatables.inc' %]
424
    [% INCLUDE 'mana.inc' %]
425
    <script>
424
    <script>
426
        var subscriptionid = "[% subscriptionid | html %]";
425
        var subscriptionid = "[% subscriptionid | html %]";
427
        var MSG_CLOSE_SUBSCRIPTION = _("Are you sure you want to close this subscription?");
426
        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 30-35 Link Here
30
            <main>
30
            <main>
31
31
32
    [% INCLUDE 'serials-toolbar.inc' %]
32
    [% INCLUDE 'serials-toolbar.inc' %]
33
    [% INCLUDE 'mana/mana-comment-status.inc' %]
33
34
34
    <h1>Subscription for [% bibliotitle | html %] [% IF closed %](closed)[% END %]</h1>
35
    <h1>Subscription for [% bibliotitle | html %] [% IF closed %](closed)[% END %]</h1>
35
    [% IF ( abouttoexpire ) %]
36
    [% IF ( abouttoexpire ) %]
Lines 476-483 Link Here
476
        var MSG_REOPEN_SUBSCRIPTION = _("Are you sure you want to reopen this subscription?");
477
        var MSG_REOPEN_SUBSCRIPTION = _("Are you sure you want to reopen this subscription?");
477
        var CONFIRM_DELETE_SUBSCRIPTION = _("Are you sure you want to delete this subscription?");
478
        var CONFIRM_DELETE_SUBSCRIPTION = _("Are you sure you want to delete this subscription?");
478
    </script>
479
    </script>
479
    [% INCLUDE 'mana.inc' %]
480
    [% Asset.js("js/serials-toolbar.js") | $raw %]
480
    [% Asset.js("js/serials-toolbar.js") | $raw %]
481
    [% Asset.js("js/mana.js") | $raw %]
481
    [% INCLUDE 'datatables.inc' %]
482
    [% INCLUDE 'datatables.inc' %]
482
    [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %]
483
    [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %]
483
    [% INCLUDE 'columns_settings.inc' %]
484
    [% INCLUDE 'columns_settings.inc' %]
Lines 521-529 Link Here
521
                table.fnFilter( '', 4 ); // Not filter, display all columns
522
                table.fnFilter( '', 4 ); // Not filter, display all columns
522
            });
523
            });
523
            $("#show_all_orders").click();
524
            $("#show_all_orders").click();
524
525
526
        });
525
        });
526
527
        function mana_comment_close(){
528
            $("#selected_id").val("");
529
            $("#mana-resource-id").val("");
530
            $("#mana-comment").val("");
531
            $("#mana-comment-box").modal("hide");
532
        }
527
    </script>
533
    </script>
528
[% END %]
534
[% END %]
529
535
(-)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