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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/merge-record-strings.inc (-1 / +1 lines)
Lines 1-5 Link Here
1
[%# transletable strings for merge-record.js %]
1
[%# transletable strings for merge-record.js %]
2
<script type="text/javascript">
2
<script>
3
    var MSG_MERGEREC_ALREADY_EXISTS = _("The field is non-repeatable and already exists in the destination record. Therefore, you cannot add it.");
3
    var MSG_MERGEREC_ALREADY_EXISTS = _("The field is non-repeatable and already exists in the destination record. Therefore, you cannot add it.");
4
    var MSG_MERGEREC_SUBFIELD_ALREADY_EXISTS = _("The subfield is non-repeatable and already exists in the destination record. Therefore, you cannot add it.");
4
    var MSG_MERGEREC_SUBFIELD_ALREADY_EXISTS = _("The subfield is non-repeatable and already exists in the destination record. Therefore, you cannot add it.");
5
</script>
5
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/item_circulation_alerts.tt (-6 / +5 lines)
Lines 51-59 table.grid td.default { Link Here
51
    <div class="row">
51
    <div class="row">
52
        <div class="col-sm-10 col-sm-push-2">
52
        <div class="col-sm-10 col-sm-push-2">
53
            <main>
53
            <main>
54
54
                <div class="row">
55
<div class="yui-g">
55
                    <div class="col-sm-6">
56
<div class="yui-u first">
57
<h1>Item circulation alerts</h1>
56
<h1>Item circulation alerts</h1>
58
<h2>Select a library:</h2>
57
<h2>Select a library:</h2>
59
<form id="branch_selector" method="get" action="/cgi-bin/koha/admin/item_circulation_alerts.pl">
58
<form id="branch_selector" method="get" action="/cgi-bin/koha/admin/item_circulation_alerts.pl">
Lines 64-70 table.grid td.default { Link Here
64
<input type="submit" name="pick" value="Pick" />
63
<input type="submit" name="pick" value="Pick" />
65
</form>
64
</form>
66
</div>
65
</div>
67
<div class="yui-u">
66
                    <div class="col-sm-6">
68
<table class="grid">
67
<table class="grid">
69
<caption>Legend</caption>
68
<caption>Legend</caption>
70
<thead>
69
<thead>
Lines 88-95 table.grid td.default { Link Here
88
  </tr>
87
  </tr>
89
</tbody>
88
</tbody>
90
</table>
89
</table>
91
</div>
90
                    </div> <!-- /.col-sm-6 -->
92
</div>
91
                </div> <!-- /.row -->
93
92
94
<h2>Circulation alerts for [% Branches.GetName( branch ) || 'Default' | html %]</h2>
93
<h2>Circulation alerts for [% Branches.GetName( branch ) || 'Default' | html %]</h2>
95
<p>Click on the grid to toggle the settings.</p>
94
<p>Click on the grid to toggle the settings.</p>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt (-12 / +12 lines)
Lines 5-11 Link Here
5
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
<title>Koha &rsaquo; Cataloging &rsaquo; Merging records</title>
6
<title>Koha &rsaquo; Cataloging &rsaquo; Merging records</title>
7
[% INCLUDE 'doc-head-close.inc' %]
7
[% INCLUDE 'doc-head-close.inc' %]
8
<style type="text/css">
8
<style>
9
div.record ul, div.record li { float:none; display:block; }
9
div.record ul, div.record li { float:none; display:block; }
10
div#result { margin-top: 1em; }
10
div#result { margin-top: 1em; }
11
/* We use this style "against" the li ui-tabs-nav style automatically applied */
11
/* We use this style "against" the li ui-tabs-nav style automatically applied */
Lines 20-25 div#result { margin-top: 1em; } Link Here
20
<div class="main container-fluid">
20
<div class="main container-fluid">
21
    <div class="row">
21
    <div class="row">
22
        <div class="col-md-8 col-md-offset-2">
22
        <div class="col-md-8 col-md-offset-2">
23
            <main>
23
24
24
<h1>Merging records</h1>
25
<h1>Merging records</h1>
25
26
Lines 45-51 div#result { margin-top: 1em; } Link Here
45
46
46
[% ELSIF ( result ) %]
47
[% ELSIF ( result ) %]
47
48
48
        <script type="text/javascript">window.location.href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 | html %]"</script>
49
    <script>window.location.href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 | html %]";</script>
49
        <p>The merging was successful. <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 | html %]">Click here to see the merged record.</a></p>
50
        <p>The merging was successful. <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 | html %]">Click here to see the merged record.</a></p>
50
51
51
[% ELSIF ( choosereference ) %]
52
[% ELSIF ( choosereference ) %]
Lines 84-96 div#result { margin-top: 1em; } Link Here
84
85
85
<form id="mergeform" action="/cgi-bin/koha/authorities/merge.pl" method="post" onsubmit="return mergeformsubmit()">
86
<form id="mergeform" action="/cgi-bin/koha/authorities/merge.pl" method="post" onsubmit="return mergeformsubmit()">
86
87
87
<div class="yui-g">
88
    <div class="row">
88
<div class="yui-u first">
89
        <div class="col-sm-6">
89
[% PROCESS mergesource sourcerecords=records %]
90
[% PROCESS mergesource sourcerecords=records %]
90
</div>
91
</div>
91
<div class="yui-u">
92
        <div class="col-sm-6">
92
[% PROCESS mergetarget %]
93
[% PROCESS mergetarget %]
93
</div> <!-- .yui-u -->
94
</div>
95
</div>
94
96
95
<input type="hidden" name="recordid1" value="[% recordid1 | html %]" />
97
<input type="hidden" name="recordid1" value="[% recordid1 | html %]" />
96
<input type="hidden" name="recordid2" value="[% recordid2 | html %]" />
98
<input type="hidden" name="recordid2" value="[% recordid2 | html %]" />
Lines 98-117 div#result { margin-top: 1em; } Link Here
98
<input type="hidden" name="frameworkcode" value="[% framework | html %]" />
100
<input type="hidden" name="frameworkcode" value="[% framework | html %]" />
99
101
100
<fieldset class="action"><input type="submit" name="merge" value="Merge" /></fieldset>
102
<fieldset class="action"><input type="submit" name="merge" value="Merge" /></fieldset>
101
</div>
102
</form>
103
</form>
103
104
104
[% END %]
105
[% END %]
105
106
106
</div>
107
        </main>
108
    </div> <!-- /.col-md-8 col-md-offset-2 -->
109
</div> <!-- /.row -->
107
110
108
[% MACRO jsinclude BLOCK %]
111
[% MACRO jsinclude BLOCK %]
109
    [% INCLUDE 'merge-record-strings.inc' %]
112
    [% INCLUDE 'merge-record-strings.inc' %]
110
    [% INCLUDE 'authorities_js.inc' %]
113
    [% INCLUDE 'authorities_js.inc' %]
111
    [% Asset.js("js/merge-record.js") | $raw %]
114
    [% Asset.js("js/merge-record.js") | $raw %]
112
    [% INCLUDE 'merge-record-strings.inc' %]
115
    <script>
113
    <script type="text/javascript">
114
    //<![CDATA[
115
116
116
        // When submiting the form
117
        // When submiting the form
117
        function mergeformsubmit() {
118
        function mergeformsubmit() {
Lines 140-146 div#result { margin-top: 1em; } Link Here
140
        $("#Frameworks").val(fw);
141
        $("#Frameworks").val(fw);
141
    }
142
    }
142
143
143
    //]]>
144
    </script>
144
    </script>
145
[% END %]
145
[% END %]
146
146
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/stockrotation.tt (-11 / +14 lines)
Lines 14-24 Link Here
14
14
15
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>  &rsaquo; Stock rotation details for <i>[% biblio.title | html %][% FOREACH subtitle IN biblio.subtitles %][% subtitle.subfield | html %][% END %]</i></div>
15
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>  &rsaquo; Stock rotation details for <i>[% biblio.title | html %][% FOREACH subtitle IN biblio.subtitles %][% subtitle.subfield | html %][% END %]</i></div>
16
16
17
<div id="doc3" class="yui-t2">
17
<div class="main container-fluid">
18
18
    <div class="row">
19
   <div id="bd">
19
        <div class="col-sm-10 col-sm-push-2">
20
    <div id="yui-main">
20
            <main>
21
    <div class="yui-b">
22
21
23
<div id="catalogue_detail_biblio">
22
<div id="catalogue_detail_biblio">
24
23
Lines 157-168 Link Here
157
156
158
</div>
157
</div>
159
158
160
</div>
159
            </main>
161
</div>
160
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
162
<div class="yui-b">
161
163
[% INCLUDE 'biblio-view-menu.inc' %]
162
        <div class="col-sm-2 col-sm-pull-10">
164
</div>
163
            <aside>
165
</div>
164
                [% INCLUDE 'biblio-view-menu.inc' %]
165
            </aside>
166
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
167
    </div> <!-- /.row -->
168
166
169
167
[% MACRO jsinclude BLOCK %]
170
[% MACRO jsinclude BLOCK %]
168
    [% INCLUDE 'browser-strings.inc' %]
171
    [% INCLUDE 'browser-strings.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt (-293 / +296 lines)
Lines 3-297 Link Here
3
[% USE Branches %]
3
[% USE Branches %]
4
[% USE Koha %]
4
[% USE Koha %]
5
[% USE KohaDates %]
5
[% USE KohaDates %]
6
6
[% SET footerjs = 1 %]
7
[% INCLUDE 'doc-head-open.inc' %]
7
[% INCLUDE 'doc-head-open.inc' %]
8
<title>Koha &rsaquo; ILL requests  &rsaquo;</title>
8
<title>Koha &rsaquo; ILL requests  &rsaquo;</title>
9
[% INCLUDE 'doc-head-close.inc' %]
9
[% INCLUDE 'doc-head-close.inc' %]
10
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
11
[% Asset.css("css/datatables.css") | $raw %]
10
[% Asset.css("css/datatables.css") | $raw %]
12
[% INCLUDE 'datatables.inc' %]
13
<script type="text/javascript">
14
    //<![CDATA[
15
    $(document).ready(function() {
16
17
        // Illview Datatable setup
18
19
        // Fields we don't want to display
20
        var ignore = [
21
            'accessurl',
22
            'backend',
23
            'branchcode',
24
            'completed',
25
            'capabilities',
26
            'cost',
27
            'medium',
28
            'notesopac',
29
            'notesstaff',
30
            'placed',
31
            'replied'
32
        ];
33
34
        // Fields we need to expand (flatten)
35
        var expand = [
36
            'metadata',
37
            'patron'
38
        ];
39
40
        // Expanded fields
41
        // This is auto populated
42
        var expanded = {};
43
44
        // The core fields that should be displayed first
45
        var core = [
46
            'metadata_Author',
47
            'metadata_Title',
48
            'borrowername',
49
            'biblio_id',
50
            'library',
51
            'status',
52
            'updated',
53
            'illrequest_id',
54
            'action'
55
        ];
56
57
        // Remove any fields we're ignoring
58
        var removeIgnore = function(dataObj) {
59
            dataObj.forEach(function(thisRow) {
60
                ignore.forEach(function(thisIgnore) {
61
                    if (thisRow.hasOwnProperty(thisIgnore)) {
62
                        delete thisRow[thisIgnore];
63
                    }
64
                });
65
            });
66
        };
67
68
        // Expand any fields we're expanding
69
        var expandExpand = function(row) {
70
            expand.forEach(function(thisExpand) {
71
                if (row.hasOwnProperty(thisExpand)) {
72
                    if (!expanded.hasOwnProperty(thisExpand)) {
73
                        expanded[thisExpand] = [];
74
                    }
75
                    var expandObj = row[thisExpand];
76
                    Object.keys(expandObj).forEach(
77
                        function(thisExpandCol) {
78
                            var expColName = thisExpand + '_' + thisExpandCol;
79
                            // Keep a list of fields that have been expanded
80
                            // so we can create toggle links for them
81
                            if (expanded[thisExpand].indexOf(expColName) == -1) {
82
                                expanded[thisExpand].push(expColName);
83
                            }
84
                            expandObj[expColName] =
85
                                expandObj[thisExpandCol];
86
                            delete expandObj[thisExpandCol];
87
                        }
88
                    );
89
                    $.extend(true, row, expandObj);
90
                    delete row[thisExpand];
91
                }
92
            });
93
        };
94
95
        // Build a de-duped list of all column names
96
        var allCols = {};
97
        core.map(function(thisCore) {
98
            allCols[thisCore] = 1;
99
        });
100
101
        // Strip the expand prefix if it exists, we do this for display
102
        var stripPrefix = function(value) {
103
            expand.forEach(function(thisExpand) {
104
                var regex = new RegExp(thisExpand + '_', 'g');
105
                value = value.replace(regex, '');
106
            });
107
            return value;
108
        };
109
110
        // Our 'render' function for borrowerlink
111
        var createPatronLink = function(data, type, row) {
112
            return '<a title="' + _("View borrower details") + '" ' +
113
                'href="/cgi-bin/koha/members/moremember.pl?' +
114
                'borrowernumber='+row.borrowernumber+'">' +
115
                row.patron_firstname + ' ' + row.patron_surname +
116
                '</a>';
117
        };
118
119
        // Our 'render' function for biblio_id
120
        var createBiblioLink = function(data, type, row) {
121
            return (row.biblio_id) ?
122
                '<a title="' + _("View biblio details") + '" ' +
123
                'href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' +
124
                row.biblio_id + '">' +
125
                row.biblio_id +
126
                '</a>' : '';
127
        };
128
129
        // Our 'render' function for the library name
130
        var createLibrary = function(data, type, row) {
131
            return row.library.branchname;
132
        };
133
134
        // Render function for request ID
135
        var createRequestId = function(data, type, row) {
136
            return row.id_prefix + row.illrequest_id;
137
        };
138
139
        // Render function for request status
140
        var createStatus = function(data, type, row, meta) {
141
            var origData = meta.settings.oInit.originalData;
142
            if (origData.length > 0) {
143
                var status_name = meta.settings.oInit.originalData[0].capabilities[
144
                    row.status
145
                ].name;
146
                switch( status_name ) {
147
                    case "New request":
148
                        return _("New request");
149
                    case "Requested":
150
                        return _("Requested");
151
                    case "Requested from partners":
152
                        return _("Requested from partners");
153
                    case "Request reverted":
154
                        return _("Request reverted");
155
                    case "Queued request":
156
                        return _("Queued request");
157
                    case "Cancellation requested":
158
                        return _("Cancellation requested");
159
                    case "Completed":
160
                        return _("Completed");
161
                    case "Delete request":
162
                        return _("Delete request");
163
                    default:
164
                        return status_name;
165
                }
166
            } else {
167
                return '';
168
            }
169
        };
170
171
        // Render function for creating a row's action link
172
        var createActionLink = function(data, type, row) {
173
            return '<a class="btn btn-default btn-sm" ' +
174
                'href="/cgi-bin/koha/ill/ill-requests.pl?' +
175
                'method=illview&amp;illrequest_id=' +
176
                row.illrequest_id +
177
                '">' + _("Manage request") + '</a>';
178
        };
179
180
        // Columns that require special treatment
181
        var specialCols = {
182
            action: {
183
                name: '',
184
                func: createActionLink
185
            },
186
            borrowername: {
187
                name: _("Patron"),
188
                func: createPatronLink
189
            },
190
            illrequest_id: {
191
                name: _("Request number"),
192
                func: createRequestId
193
            },
194
            status: {
195
                name: _("Status"),
196
                func: createStatus
197
            },
198
            biblio_id: {
199
                name: _("Bibliograpic record ID"),
200
                func: createBiblioLink
201
            },
202
            library: {
203
                name: _("Library"),
204
                func: createLibrary
205
            }
206
        };
207
208
        // Filter partner list
209
        $('#partner_filter').keyup(function() {
210
            var needle = $('#partner_filter').val();
211
            $('#partners > option').each(function() {
212
                var regex = new RegExp(needle, 'i');
213
                if (
214
                    needle.length == 0 ||
215
                    $(this).is(':selected') ||
216
                    $(this).text().match(regex)
217
                ) {
218
                    $(this).show();
219
                } else {
220
                    $(this).hide();
221
                }
222
            });
223
        });
224
225
        // Display the modal containing request supplier metadata
226
        $('#ill-request-display-metadata').on('click', function(e) {
227
            e.preventDefault();
228
            $('#dataPreview').modal({show:true});
229
        });
230
231
        // Get our data from the API and process it prior to passing
232
        // it to datatables
233
        var ajax = $.ajax(
234
            '/api/v1/illrequests?embed=metadata,patron,capabilities,library'
235
            ).done(function() {
236
                var data = JSON.parse(ajax.responseText);
237
                // Make a copy, we'll be removing columns next and need
238
                // to be able to refer to data that has been removed
239
                var dataCopy = $.extend(true, [], data);
240
                // Remove all columns we're not interested in
241
                removeIgnore(dataCopy);
242
                // Expand columns that need it and create an array
243
                // of all column names
244
                $.each(dataCopy, function(k, row) {
245
                    expandExpand(row);
246
                });
247
248
                // Assemble an array of column definitions for passing
249
                // to datatables
250
                var colData = [];
251
                Object.keys(allCols).forEach(function(thisCol) {
252
                    // Create the base column object
253
                    var colObj = {
254
                        name: thisCol,
255
                        className: thisCol
256
                    };
257
                    // We may need to process the data going in this
258
                    // column, so do it if necessary
259
                    if (
260
                        specialCols.hasOwnProperty(thisCol) &&
261
                        specialCols[thisCol].hasOwnProperty('func')
262
                    ) {
263
                        colObj.render = specialCols[thisCol].func;
264
                    } else {
265
                        colObj.data = thisCol;
266
                    }
267
                    colData.push(colObj);
268
                });
269
270
                // Initialise the datatable
271
                $('#ill-requests').DataTable($.extend(true, {}, dataTablesDefaults, {
272
                    'aoColumnDefs': [  // Last column shouldn't be sortable or searchable
273
                        {
274
                            'aTargets': [ 'actions' ],
275
                            'bSortable': false,
276
                            'bSearchable': false
277
                        },
278
                    ],
279
                    'aaSorting': [[ 6, 'desc' ]], // Default sort, updated descending
280
                    'processing': true, // Display a message when manipulating
281
                    'iDisplayLength': 10, // 10 results per page
282
                    'sPaginationType': "full_numbers", // Pagination display
283
                    'deferRender': true, // Improve performance on big datasets
284
                    'data': dataCopy,
285
                    'columns': colData,
286
                    'originalData': data // Enable render functions to access
287
                                       // our original data
288
                }));
289
            }
290
        );
291
292
    });
293
    //]]>
294
</script>
295
</head>
11
</head>
296
12
297
<body id="illrequests" class="ill">
13
<body id="illrequests" class="ill">
Lines 308-317 Link Here
308
    [% END %]
24
    [% END %]
309
</div>
25
</div>
310
26
311
<div id="doc3" class="yui-t2">
27
<div class="main container-fluid">
312
    <div id="bd">
28
    <div class="row">
313
        <div id="yui-main">
29
        <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
314
            <div id="interlibraryloans" class="yui-b">
30
            <main>
31
32
            <div id="interlibraryloans">
315
        [% IF !backends_available %]
33
        [% IF !backends_available %]
316
            <div class="dialog message">ILL module configuration problem. Take a look at the <a href="/cgi-bin/koha/about.pl#sysinfo">about page</a></div>
34
            <div class="dialog message">ILL module configuration problem. Take a look at the <a href="/cgi-bin/koha/about.pl#sysinfo">about page</a></div>
317
        [% ELSE %]
35
        [% ELSE %]
Lines 486-492 Link Here
486
                [% ELSIF query_type == 'illview' %]
204
                [% ELSIF query_type == 'illview' %]
487
                    [% req_status = request.status %]
205
                    [% req_status = request.status %]
488
                    <h1>Manage ILL request</h1>
206
                    <h1>Manage ILL request</h1>
489
                    <div id="toolbar" class="btn-toolbar">
207
                    <div class="btn-toolbar">
490
                        <a title="Edit request" id="ill-toolbar-btn-edit-action" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=edit_action&amp;illrequest_id=[% request.illrequest_id | html %]">
208
                        <a title="Edit request" id="ill-toolbar-btn-edit-action" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=edit_action&amp;illrequest_id=[% request.illrequest_id | html %]">
491
                        <span class="fa fa-pencil"></span>
209
                        <span class="fa fa-pencil"></span>
492
                        Edit request
210
                        Edit request
Lines 635-647 Link Here
635
                [% END %]
353
                [% END %]
636
        [% END %]
354
        [% END %]
637
            </div>
355
            </div>
638
        </div>
356
639
    </div>
357
            </main>
640
</div>
358
        </div> <!-- /.col-sm-12 -->
359
    </div> <!-- /.row -->
360
641
361
642
[% TRY %]
362
[% TRY %]
643
[% PROCESS backend_jsinclude %]
363
[% PROCESS backend_jsinclude %]
644
[% CATCH %]
364
[% CATCH %]
645
[% END %]
365
[% END %]
646
366
367
[% MACRO jsinclude BLOCK %]
368
    [% INCLUDE 'datatables.inc' %]
369
    <script>
370
        $(document).ready(function() {
371
372
            // Illview Datatable setup
373
374
            // Fields we don't want to display
375
            var ignore = [
376
                'accessurl',
377
                'backend',
378
                'branchcode',
379
                'completed',
380
                'capabilities',
381
                'cost',
382
                'medium',
383
                'notesopac',
384
                'notesstaff',
385
                'placed',
386
                'replied'
387
            ];
388
389
            // Fields we need to expand (flatten)
390
            var expand = [
391
                'metadata',
392
                'patron'
393
            ];
394
395
            // Expanded fields
396
            // This is auto populated
397
            var expanded = {};
398
399
            // The core fields that should be displayed first
400
            var core = [
401
                'metadata_Author',
402
                'metadata_Title',
403
                'borrowername',
404
                'biblio_id',
405
                'library',
406
                'status',
407
                'updated',
408
                'illrequest_id',
409
                'action'
410
            ];
411
412
            // Remove any fields we're ignoring
413
            var removeIgnore = function(dataObj) {
414
                dataObj.forEach(function(thisRow) {
415
                    ignore.forEach(function(thisIgnore) {
416
                        if (thisRow.hasOwnProperty(thisIgnore)) {
417
                            delete thisRow[thisIgnore];
418
                        }
419
                    });
420
                });
421
            };
422
423
            // Expand any fields we're expanding
424
            var expandExpand = function(row) {
425
                expand.forEach(function(thisExpand) {
426
                    if (row.hasOwnProperty(thisExpand)) {
427
                        if (!expanded.hasOwnProperty(thisExpand)) {
428
                            expanded[thisExpand] = [];
429
                        }
430
                        var expandObj = row[thisExpand];
431
                        Object.keys(expandObj).forEach(
432
                            function(thisExpandCol) {
433
                                var expColName = thisExpand + '_' + thisExpandCol;
434
                                // Keep a list of fields that have been expanded
435
                                // so we can create toggle links for them
436
                                if (expanded[thisExpand].indexOf(expColName) == -1) {
437
                                    expanded[thisExpand].push(expColName);
438
                                }
439
                                expandObj[expColName] =
440
                                    expandObj[thisExpandCol];
441
                                delete expandObj[thisExpandCol];
442
                            }
443
                        );
444
                        $.extend(true, row, expandObj);
445
                        delete row[thisExpand];
446
                    }
447
                });
448
            };
449
450
            // Build a de-duped list of all column names
451
            var allCols = {};
452
            core.map(function(thisCore) {
453
                allCols[thisCore] = 1;
454
            });
455
456
            // Strip the expand prefix if it exists, we do this for display
457
            var stripPrefix = function(value) {
458
                expand.forEach(function(thisExpand) {
459
                    var regex = new RegExp(thisExpand + '_', 'g');
460
                    value = value.replace(regex, '');
461
                });
462
                return value;
463
            };
464
465
            // Our 'render' function for borrowerlink
466
            var createPatronLink = function(data, type, row) {
467
                return '<a title="' + _("View patron details") + '" ' +
468
                    'href="/cgi-bin/koha/members/moremember.pl?' +
469
                    'borrowernumber='+row.borrowernumber+'">' +
470
                    row.patron_firstname + ' ' + row.patron_surname +
471
                    '</a>';
472
            };
473
474
            // Our 'render' function for biblio_id
475
            var createBiblioLink = function(data, type, row) {
476
                return (row.biblio_id) ?
477
                    '<a title="' + _("View record details") + '" ' +
478
                    'href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' +
479
                    row.biblio_id + '">' +
480
                    row.biblio_id +
481
                    '</a>' : '';
482
            };
483
484
            // Our 'render' function for the library name
485
            var createLibrary = function(data, type, row) {
486
                return row.library.branchname;
487
            };
488
489
            // Render function for request ID
490
            var createRequestId = function(data, type, row) {
491
                return row.id_prefix + row.illrequest_id;
492
            };
493
494
            // Render function for request status
495
            var createStatus = function(data, type, row, meta) {
496
                var origData = meta.settings.oInit.originalData;
497
                if (origData.length > 0) {
498
                    var status_name = meta.settings.oInit.originalData[0].capabilities[
499
                        row.status
500
                    ].name;
501
                    switch( status_name ) {
502
                        case "New request":
503
                            return _("New request");
504
                        case "Requested":
505
                            return _("Requested");
506
                        case "Requested from partners":
507
                            return _("Requested from partners");
508
                        case "Request reverted":
509
                            return _("Request reverted");
510
                        case "Queued request":
511
                            return _("Queued request");
512
                        case "Cancellation requested":
513
                            return _("Cancellation requested");
514
                        case "Completed":
515
                            return _("Completed");
516
                        case "Delete request":
517
                            return _("Delete request");
518
                        default:
519
                            return status_name;
520
                    }
521
                } else {
522
                    return '';
523
                }
524
            };
525
526
            // Render function for creating a row's action link
527
            var createActionLink = function(data, type, row) {
528
                return '<a class="btn btn-default btn-xs" ' +
529
                    'href="/cgi-bin/koha/ill/ill-requests.pl?' +
530
                    'method=illview&amp;illrequest_id=' +
531
                    row.illrequest_id +
532
                    '">' + _("Manage request") + '</a>';
533
            };
534
535
            // Columns that require special treatment
536
            var specialCols = {
537
                action: {
538
                    name: '',
539
                    func: createActionLink
540
                },
541
                borrowername: {
542
                    name: _("Patron"),
543
                    func: createPatronLink
544
                },
545
                illrequest_id: {
546
                    name: _("Request number"),
547
                    func: createRequestId
548
                },
549
                status: {
550
                    name: _("Status"),
551
                    func: createStatus
552
                },
553
                biblio_id: {
554
                    name: _("Bibliograpic record ID"),
555
                    func: createBiblioLink
556
                },
557
                library: {
558
                    name: _("Library"),
559
                    func: createLibrary
560
                }
561
            };
562
563
            // Filter partner list
564
            $('#partner_filter').keyup(function() {
565
                var needle = $('#partner_filter').val();
566
                $('#partners > option').each(function() {
567
                    var regex = new RegExp(needle, 'i');
568
                    if (
569
                        needle.length == 0 ||
570
                        $(this).is(':selected') ||
571
                        $(this).text().match(regex)
572
                    ) {
573
                        $(this).show();
574
                    } else {
575
                        $(this).hide();
576
                    }
577
                });
578
            });
579
580
            // Display the modal containing request supplier metadata
581
            $('#ill-request-display-metadata').on('click', function(e) {
582
                e.preventDefault();
583
                $('#dataPreview').modal({show:true});
584
            });
585
586
            // Get our data from the API and process it prior to passing
587
            // it to datatables
588
            var ajax = $.ajax(
589
                '/api/v1/illrequests?embed=metadata,patron,capabilities,library'
590
                ).done(function() {
591
                    var data = JSON.parse(ajax.responseText);
592
                    // Make a copy, we'll be removing columns next and need
593
                    // to be able to refer to data that has been removed
594
                    var dataCopy = $.extend(true, [], data);
595
                    // Remove all columns we're not interested in
596
                    removeIgnore(dataCopy);
597
                    // Expand columns that need it and create an array
598
                    // of all column names
599
                    $.each(dataCopy, function(k, row) {
600
                        expandExpand(row);
601
                    });
602
603
                    // Assemble an array of column definitions for passing
604
                    // to datatables
605
                    var colData = [];
606
                    Object.keys(allCols).forEach(function(thisCol) {
607
                        // Create the base column object
608
                        var colObj = {
609
                            name: thisCol,
610
                            className: thisCol
611
                        };
612
                        // We may need to process the data going in this
613
                        // column, so do it if necessary
614
                        if (
615
                            specialCols.hasOwnProperty(thisCol) &&
616
                            specialCols[thisCol].hasOwnProperty('func')
617
                        ) {
618
                            colObj.render = specialCols[thisCol].func;
619
                        } else {
620
                            colObj.data = thisCol;
621
                        }
622
                        colData.push(colObj);
623
                    });
624
625
                    // Initialise the datatable
626
                    $('#ill-requests').DataTable($.extend(true, {}, dataTablesDefaults, {
627
                        'aoColumnDefs': [  // Last column shouldn't be sortable or searchable
628
                            {
629
                                'aTargets': [ 'actions' ],
630
                                'bSortable': false,
631
                                'bSearchable': false
632
                            },
633
                        ],
634
                        'aaSorting': [[ 6, 'desc' ]], // Default sort, updated descending
635
                        'processing': true, // Display a message when manipulating
636
                        'sPaginationType': "full_numbers", // Pagination display
637
                        'deferRender': true, // Improve performance on big datasets
638
                        'data': dataCopy,
639
                        'columns': colData,
640
                        'originalData': data // Enable render functions to access
641
                                           // our original data
642
                    }));
643
                }
644
            );
645
646
        });
647
    </script>
648
[% END %]
649
647
[% INCLUDE 'intranet-bottom.inc' %]
650
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt (-15 / +19 lines)
Lines 23-38 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
23
        <div class="row">
23
        <div class="row">
24
            <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
24
            <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
25
[% ELSE %]
25
[% ELSE %]
26
    <div id="doc3" class="yui-t2">
26
    <div class="main container-fluid">
27
        <div id="bd">
27
        <div class="row">
28
            <div id="yui-main">
28
            <div class="col-sm-10 col-sm-push-2">
29
                <div class="yui-b">
30
[% END %]
29
[% END %]
30
                <main>
31
31
32
[% UNLESS ( add_form ) %]
32
[% UNLESS ( add_form ) %]
33
    [% IF error_message == 'title_missing' %]
33
    [% IF error_message == 'title_missing' %]
34
        <div class="dialog alert">Error: Required news title missing!</div>
34
        <div class="dialog alert">Error: Required news title missing!</div>
35
    [% END %]
35
    [% END %]
36
<h2>News</h2>
36
<div id="toolbar" class="btn-toolbar">
37
<div id="toolbar" class="btn-toolbar">
37
    <a class="btn btn-default btn-sm" id="newentry" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;lang=[% lang | html %]"><i class="fa fa-plus"></i> New entry</a>
38
    <a class="btn btn-default btn-sm" id="newentry" href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;lang=[% lang | html %]"><i class="fa fa-plus"></i> New entry</a>
38
</div>
39
</div>
Lines 216-236 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
216
            <div class="dialog message">There are no news items.</div>
217
            <div class="dialog message">There are no news items.</div>
217
        [% END %]
218
        [% END %]
218
    [% END %]
219
    [% END %]
219
</div>
220
220
</div>
221
                </main>
221
[% UNLESS ( add_form ) %]
222
            [% UNLESS ( add_form ) %]
222
    <div class="yui-b noprint">
223
                </div> <!-- /.col-sm-10.col-sm-push-2 -->
223
        [% INCLUDE 'tools-menu.inc' %]
224
224
    </div>
225
                <div class="col-sm-2 col-sm-pull-10">
225
[% END %]
226
                    <aside>
226
</div>
227
                        [% INCLUDE 'tools-menu.inc' %]
228
                    </aside>
229
                </div> <!-- /.col-sm-2.col-sm-pull-10 -->
230
            [% END %]
231
        </div> <!-- /.row -->
227
232
228
[% MACRO jsinclude BLOCK %]
233
[% MACRO jsinclude BLOCK %]
229
    [% INCLUDE 'calendar.inc' %]
234
    [% INCLUDE 'calendar.inc' %]
230
    [% Asset.js("js/tools-menu.js") | $raw %]
235
    [% Asset.js("js/tools-menu.js") | $raw %]
231
    [% IF ( opac_news_count ) %]
236
    [% IF ( opac_news_count ) %]
232
        [% INCLUDE 'datatables.inc' %]
237
        [% INCLUDE 'datatables.inc' %]
233
        <script type="text/javascript">
238
        <script>
234
            $(document).ready(function() {
239
            $(document).ready(function() {
235
                $("#newst").dataTable($.extend(true, {}, dataTablesDefaults, {
240
                $("#newst").dataTable($.extend(true, {}, dataTablesDefaults, {
236
                    "aoColumnDefs": [
241
                    "aoColumnDefs": [
Lines 268-274 Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> Link Here
268
        </script>
273
        </script>
269
    [% END %]
274
    [% END %]
270
    [% Asset.js("lib/tiny_mce/tiny_mce.js") | $raw %]
275
    [% Asset.js("lib/tiny_mce/tiny_mce.js") | $raw %]
271
    <script type="text/javascript">
276
    <script>
272
        tinyMCE.baseURL = "[% interface | html %]/lib/tiny_mce";
277
        tinyMCE.baseURL = "[% interface | html %]/lib/tiny_mce";
273
        tinyMCE.init({
278
        tinyMCE.init({
274
            mode : "textareas",
279
            mode : "textareas",
275
- 

Return to bug 21672