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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-2 / +53 lines)
Lines 329-335 Link Here
329
                                                               class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-toggle="dropdown"
329
                                                               class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-toggle="dropdown"
330
                                                               href="#"><b class="caret"></b></a>
330
                                                               href="#"><b class="caret"></b></a>
331
                                                            <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]">
331
                                                            <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]">
332
                                                                <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&amp;phase=Show%20SQL"><i class="fa fa-search"></i> Show</a></li>
332
                                                                <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&amp;phase=Show%20SQL"><i class="fa fa-search"></i> View</a></li>
333
                                                                <li>
334
                                                                    <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&phase=Show%20SQL" class="preview_sql" data-reportid="[% savedreport.id | html %]">
335
                                                                        <i class="fa fa-eye"></i> Preview SQL
336
                                                                    </a>
337
                                                                </li>
333
                                                                [% IF ( CAN_user_reports_create_reports ) %]
338
                                                                [% IF ( CAN_user_reports_create_reports ) %]
334
                                                                    <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&amp;phase=Edit%20SQL"><i class="fa fa-pencil"></i> Edit</a></li>
339
                                                                    <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&amp;phase=Edit%20SQL"><i class="fa fa-pencil"></i> Edit</a></li>
335
                                                                    <li><a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from existing&amp;report_id=[% savedreport.id | uri %]"><i class="fa fa-copy"></i> Duplicate</a></li>
340
                                                                    <li><a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from existing&amp;report_id=[% savedreport.id | uri %]"><i class="fa fa-copy"></i> Duplicate</a></li>
Lines 343-348 Link Here
343
                                                                [% END %]
348
                                                                [% END %]
344
                                                            </ul>
349
                                                            </ul>
345
                                                        </div>
350
                                                        </div>
351
                                                        <input type="hidden" id="previewSql[% savedreport.id | html %]" value="[% savedreport.savedsql | html %]" data-title="[% savedreport.report_name | html %]" />
346
                                                    </td>
352
                                                    </td>
347
                                                </tr>
353
                                                </tr>
348
                                            [% END %]
354
                                            [% END %]
Lines 1800-1805 Link Here
1800
                e.preventDefault();
1806
                e.preventDefault();
1801
                addToList();
1807
                addToList();
1802
            });
1808
            });
1809
1810
            $("body").on("click", ".preview_sql", function(e){
1811
                e.preventDefault();
1812
                var reportid = $(this).data("reportid");
1813
                previewSql( reportid );
1814
            });
1803
        });
1815
        });
1804
1816
1805
        function tabsInit( ui, rtable ){
1817
        function tabsInit( ui, rtable ){
Lines 1927-1932 Link Here
1927
            window.open(url, 'Add_to_virtualshelf', 'width=500, height=400, toolbar=false, scrollbars=yes');
1939
            window.open(url, 'Add_to_virtualshelf', 'width=500, height=400, toolbar=false, scrollbars=yes');
1928
            return false;
1940
            return false;
1929
        }
1941
        }
1942
1943
        // Adapted from https://gist.github.com/jnormore/7418776
1944
        function previewSql(reportid) {
1945
            var yes_label = "";
1946
            var no_label = "";
1947
            var message = $("#previewSql" + reportid ).val();
1948
            var title = $("#previewSql" + reportid ).data("title");
1949
            if( $("#preview-sql-modal").length > 0) {
1950
                $("#preview-sql-modal").remove();
1951
            }
1952
            $("body").append('<div id="preview-sql-modal" tabindex="-1" role="dialog" aria-hidden="true" class="modal">\
1953
                <div class="modal-dialog">\
1954
                    <div class="modal-content">\
1955
                        <div class="modal-header" style="min-height:40px;">\
1956
                            <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">\
1957
                                <span aria-hidden="true">×</span>\
1958
                            </button>\
1959
                            <h4 class="modal-title">' + title + '</h4>\
1960
                        </div>\
1961
                        <div class="modal-body"><textarea id="code' + reportid + '">' + message + '</textarea>\
1962
                        <div class="modal-footer">\
1963
                            <a id="preview-modal-editreport" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?reports=' + reportid + '&amp;phase=Edit%20SQL"><i class="fa fa-pencil"></i> Edit</a>\
1964
                            <a id="preview-modal-duplicate" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from existing&amp;report_id=' + reportid + '"><i class="fa fa-copy"></i> Duplicate</a>\
1965
                            <a id="preview-modal-duplicate" class="btn btn-default" href="/cgi-bin/koha/tools/scheduler.pl?id=' + reportid + '"><i class="fa fa-clock-o"></i> Schedule</a>\
1966
                            <a id="preview-modal-delete" class="delete btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?reports=' + reportid + '&amp;phase=Delete%20Saved"><i class="fa fa-trash"></i> Delete</a>\
1967
                            <a id="preview-modal-runreport" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?reports=' + reportid + '&amp;phase=Run%20this%20report"><i class="fa fa-play"></i> Run report</a>\
1968
                            <a href="#" id="preview-sql-modal-cancel" data-dismiss="modal" class="btn btn-default"><i class="fa fa-remove" aria-hidden="true"></i> Close</a>\
1969
                        </div>\
1970
                    </div>\
1971
                </div>\
1972
            </div>');
1973
1974
            $("#preview-sql-modal").modal('show');
1975
            CodeMirror.fromTextArea( document.getElementById("code" + reportid ), {
1976
                lineNumbers: false,
1977
                mode: "text/x-sql",
1978
                lineWrapping: true,
1979
                readOnly: true
1980
            });
1981
        }
1930
    </script>
1982
    </script>
1931
[% END %]
1983
[% END %]
1932
1984
1933
- 

Return to bug 26708