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

(-)a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js (-1 / +8 lines)
Lines 101-104 jQuery.fn.preventDoubleFormSubmit = function() { Link Here
101
        else
101
        else
102
            this.beenSubmitted = true;
102
            this.beenSubmitted = true;
103
    });
103
    });
104
};
104
};
105
106
function delayPopup( link, title, delay ) {
107
    link = "/cgi-bin/koha/tools/delay-load.pl?url=" + escape( link ) + "&message=" + encodeURI( title ) + "&delay=" + delay; 
108
    var childWindow = window.open(link,'popup','width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
109
    return childWindow;
110
}
111
        
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (-9 / +12 lines)
Lines 4-12 Link Here
4
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
5
<script type="text/javascript">
5
<script type="text/javascript">
6
//<![CDATA[
6
//<![CDATA[
7
function Dopop(link) {
7
function doPopUp(link) {
8
    var newin=window.open(link,'popup','width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
8
    var newin=window.open(link,'popup','width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top');
9
}
9
}
10
function doDelayedPopUp( link ) {
11
    var newin = delayPopup( link, "Loading Slip", 5 );
12
}
10
	 $(document).ready(function() {
13
	 $(document).ready(function() {
11
	 	$("#exemptcheck").change(function(){
14
	 	$("#exemptcheck").change(function(){
12
			if(this.checked == true) {
15
			if(this.checked == true) {
Lines 87-93 function Dopop(link) { Link Here
87
</div>
90
</div>
88
[% END %]
91
[% END %]
89
<!-- case of a mistake in transfer loop -->
92
<!-- case of a mistake in transfer loop -->
90
[% IF ( WrongTransfer ) %]<div id="return2" class="dialog message"><!-- WrongTransfer --><h3>Please return <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% title |html %]</a> to [% TransferWaitingAt %]</h3><h3><a href="#" onclick="Dopop('transfer-slip.pl?transferitem=[% itemnumber %]&amp;&amp;branchcode=[% homebranch %]&amp;op=slip'); return true;">Print Slip</a> or <a href="/cgi-bin/koha/circ/returns.pl?itemnumber=[% itemnumber %]&amp;canceltransfer=1">Cancel Transfer</a></h3>
93
[% IF ( WrongTransfer ) %]<div id="return2" class="dialog message"><!-- WrongTransfer --><h3>Please return <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% title |html %]</a> to [% TransferWaitingAt %]</h3><h3><a href="#" onclick="doPopUp('/cgi-bin/koha/circ/transfer-slip.pl?transferitem=[% itemnumber %]&amp;&amp;branchcode=[% homebranch %]&amp;op=slip'); return true;">Print Slip</a> or <a href="/cgi-bin/koha/circ/returns.pl?itemnumber=[% itemnumber %]&amp;canceltransfer=1">Cancel Transfer</a></h3>
91
[% IF ( wborcnum ) %]<h5>Hold for:</h5>
94
[% IF ( wborcnum ) %]<h5>Hold for:</h5>
92
        <ul><li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">
95
        <ul><li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">
93
            [% borsurname %], [% borfirstname %]</a> ([% borcnum %])</li>
96
            [% borsurname %], [% borfirstname %]</a> ([% borcnum %])</li>
Lines 103-109 function Dopop(link) { Link Here
103
            <input type="hidden" name="WT-waitingAt" value="[% TransferWaitingAt %]" />
106
            <input type="hidden" name="WT-waitingAt" value="[% TransferWaitingAt %]" />
104
            <input type="hidden" name="WT-From" value="[% wtransfertFrom %]" />
107
            <input type="hidden" name="WT-From" value="[% wtransfertFrom %]" />
105
        <input type="submit" class="approve" value="Confirm" />
108
        <input type="submit" class="approve" value="Confirm" />
106
			<input type="submit" value="Print Slip and Confirm" class="print" onclick="Dopop('hold-transfer-slip.pl?transfer=1&amp;borrowernumber=[% borrowernumber %]&amp;biblionumber=[% itembiblionumber %]&amp;op=slip'); this.form.submit();" />
109
			<input type="submit" value="Print Slip and Confirm" class="print" onclick="doDelayedPopUp('/cgi-bin/koha/circ/hold-transfer-slip.pl?transfer=1&amp;borrowernumber=[% borrowernumber %]&amp;biblionumber=[% itembiblionumber %]&amp;op=slip'); this.form.submit();" />
107
    </form>
110
    </form>
108
    [% END %]</div>
111
    [% END %]</div>
109
[% END %]
112
[% END %]
Lines 139-145 function Dopop(link) { Link Here
139
        <form method="post" action="returns.pl" class="confirm">
142
        <form method="post" action="returns.pl" class="confirm">
140
            <input type="submit" class="approve" value="Confirm" />
143
            <input type="submit" class="approve" value="Confirm" />
141
144
142
			<input type="submit" value="Print and Confirm" class="print" onclick="Dopop('hold-transfer-slip.pl?borrowernumber=[% borrowernumber %]&amp;biblionumber=[% itembiblionumber %]&amp;op=slip'); this.form.submit();" />
145
			<input type="submit" value="Print and Confirm" class="print" onclick="doDelayedPopUp('/cgi-bin/koha/circ/hold-transfer-slip.pl?borrowernumber=[% borrowernumber %]&amp;biblionumber=[% itembiblionumber %]&amp;op=slip'); this.form.submit();" />
143
            [% FOREACH inputloo IN inputloop %]
146
            [% FOREACH inputloo IN inputloop %]
144
                <input type="hidden" name="ri-[% inputloo.counter %]" value="[% inputloo.barcode %]" />
147
                <input type="hidden" name="ri-[% inputloo.counter %]" value="[% inputloo.barcode %]" />
145
                <input type="hidden" name="dd-[% inputloo.counter %]" value="[% inputloo.duedate %]" />
148
                <input type="hidden" name="dd-[% inputloo.counter %]" value="[% inputloo.duedate %]" />
Lines 181-187 function Dopop(link) { Link Here
181
184
182
        <form method="post" action="returns.pl" class="confirm">
185
        <form method="post" action="returns.pl" class="confirm">
183
            <input type="submit" class="approve" value="Confirm" />
186
            <input type="submit" class="approve" value="Confirm" />
184
			<input type="submit" value="Print Slip and Confirm" class="print" onclick="Dopop('hold-transfer-slip.pl?transfer=1&amp;borrowernumber=[% borrowernumber %]&amp;biblionumber=[% itembiblionumber %]&amp;op=slip'); this.form.submit();" />
187
			<input type="submit" value="Print Slip and Confirm" class="print" onclick="doDelayedPopUp('/cgi-bin/koha/circ/hold-transfer-slip.pl?transfer=1&amp;borrowernumber=[% borrowernumber %]&amp;biblionumber=[% itembiblionumber %]&amp;op=slip'); this.form.submit();" />
185
            [% FOREACH inputloo IN inputloop %]
188
            [% FOREACH inputloo IN inputloop %]
186
                <input type="hidden" name="ri-[% inputloo.counter %]" value="[% inputloo.barcode %]" />
189
                <input type="hidden" name="ri-[% inputloo.counter %]" value="[% inputloo.barcode %]" />
187
                <input type="hidden" name="dd-[% inputloo.counter %]" value="[% inputloo.duedate %]" />
190
                <input type="hidden" name="dd-[% inputloo.counter %]" value="[% inputloo.duedate %]" />
Lines 198-204 function Dopop(link) { Link Here
198
    [% IF ( transfer ) %]
201
    [% IF ( transfer ) %]
199
    <!-- transfer: item with no reservation, must be returned to its home library -->
202
    <!-- transfer: item with no reservation, must be returned to its home library -->
200
	<div id="return1" class="dialog message">
203
	<div id="return1" class="dialog message">
201
            <h3>Please return <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% title or "item" |html %]</a> to [% homebranchname %]<br/>( <a href="#" onclick="Dopop('transfer-slip.pl?transferitem=[% itemnumber %]&amp;branchcode=[% homebranch %]&amp;op=slip'); return true;">Print Slip</a> )</h3>
204
            <h3>Please return <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% title or "item" |html %]</a> to [% homebranchname %]<br/>( <a href="#" onclick="doPopUp('/cgi-bin/koha/circ/transfer-slip.pl?transferitem=[% itemnumber %]&amp;branchcode=[% homebranch %]&amp;op=slip'); return true;">Print Slip</a> )</h3>
202
        </div>
205
        </div>
203
        [% IF ( soundon ) %]
206
        [% IF ( soundon ) %]
204
        <audio src="/intranet-tmpl/prog/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
207
        <audio src="/intranet-tmpl/prog/sound/opening.ogg" autoplay="autoplay" autobuffer="autobuffer"></audio>
Lines 214-220 function Dopop(link) { Link Here
214
	Transfer Now?<br />
217
	Transfer Now?<br />
215
    <form method="post" action="returns.pl" name="mainform" id="mainform">
218
    <form method="post" action="returns.pl" name="mainform" id="mainform">
216
    [% IF itemnumber %]
219
    [% IF itemnumber %]
217
        <input type="submit" name="dotransfer" value="Yes, Print slip" class="print" onclick="Dopop('transfer-slip.pl?transferitem=[% itemnumber %]&amp;&amp;branchcode=[% homebranch %]&amp;op=slip'); return true;" />
220
        <input type="submit" name="dotransfer" value="Yes, Print slip" class="print" onclick="doPopUp('/cgi-bin/koha/circ/transfer-slip.pl?transferitem=[% itemnumber %]&amp;&amp;branchcode=[% homebranch %]&amp;op=slip'); return true;" />
218
    [% END %]
221
    [% END %]
219
	<input type="submit" name="dotransfer" value="Yes" class="submit" />
222
	<input type="submit" name="dotransfer" value="Yes" class="submit" />
220
	<input type="submit" name="notransfer" value="No" class="submit" />
223
	<input type="submit" name="notransfer" value="No" class="submit" />
Lines 289-298 function Dopop(link) { Link Here
289
        <form method="post" action="returns.pl" class="confirm">
292
        <form method="post" action="returns.pl" class="confirm">
290
            [% IF ( transfertodo ) %]
293
            [% IF ( transfertodo ) %]
291
                <input type="submit" class="approve" value="Confirm hold and Transfer" />
294
                <input type="submit" class="approve" value="Confirm hold and Transfer" />
292
                <input type="submit" value="Print slip, Transfer, and Confirm" class="print" onclick="Dopop('hold-transfer-slip.pl?transfer=1&amp;borrowernumber=[% borrowernumber %]&amp;biblionumber=[% itembiblionumber %]&amp;op=slip'); this.form.submit();" />
295
                <input type="submit" value="Print slip, Transfer, and Confirm" class="print" onclick="doDelayedPopUp('/cgi-bin/koha/circ/hold-transfer-slip.pl?transfer=1&amp;borrowernumber=[% borrowernumber %]&amp;biblionumber=[% itembiblionumber %]&amp;op=slip'); this.form.submit();" />
293
            [% ELSE %]
296
            [% ELSE %]
294
                <input type="submit" class="approve" value="Confirm hold" />
297
                <input type="submit" class="approve" value="Confirm hold" />
295
                <input type="submit" value="Print Slip and Confirm" class="print" onclick="Dopop('hold-transfer-slip.pl?borrowernumber=[% borrowernumber %]&amp;biblionumber=[% itembiblionumber %]&amp;op=slip'); this.form.submit();" />
298
                <input type="submit" value="Print Slip and Confirm" class="print" onclick="doDelayedPopUp('/cgi-bin/koha/circ/hold-transfer-slip.pl?borrowernumber=[% borrowernumber %]&amp;biblionumber=[% itembiblionumber %]&amp;op=slip'); this.form.submit();" />
296
            [% END %]
299
            [% END %]
297
                <input type="submit" class="deny" value="Ignore" onclick="$('.dialog:visible').hide('slow'); $('#barcode').focus(); return false;" />
300
                <input type="submit" class="deny" value="Ignore" onclick="$('.dialog:visible').hide('slow'); $('#barcode').focus(); return false;" />
298
            [% FOREACH inputloo IN inputloop %]
301
            [% FOREACH inputloo IN inputloop %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/delay-load.tt (+36 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha - Please Wait While Your Page Is Loaded</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
5
</head>
6
7
<script type="text/javascript" language="javascript">
8
9
function forwardToUrl() {
10
    window.location.replace("[% url %]");
11
};
12
13
$(document).ready(function() {
14
    var i = [% delay %];
15
    var j = 0;
16
17
    while ( i > 0 ) {
18
        setTimeout("document.getElementById('counter').innerHTML='" + i + "'", j * 1000 );
19
        i--;
20
        j++;
21
    }
22
23
    setTimeout("forwardToUrl()", [% delay %] * 1000 );
24
});
25
26
</script>
27
<body>
28
29
<div class="center" style="text-align:center">
30
    <p>[% message %]</p>
31
32
    <p><img src="/intranet-tmpl/prog/img/loading.gif" alt="Loading, Please Wait"/></p>
33
34
    <div id="counter"></div>
35
</div>
36
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/tools/delay-load.pl (-1 / +83 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright 2012 Bywater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
=pod
21
22
The purpose of this script is simply to
23
delay the loading of another page. This is
24
useful to ensure race conditions are avoided
25
for items such as pop-up windows for printing
26
slips.
27
28
This script accepts the following cgi parameters:
29
url - The url to forward to
30
message - An optional message to display during the delay
31
delay - The amount of time in seconds the delay should last
32
33
A javascript function has been added to the staff functions js
34
file to facility easy use of this script. Use the function as follows:
35
36
delayPopup( url, message, delay );
37
38
where url is the url of the
39
page to load ( supports GET variables ), message is an optional
40
message to display, and delay is the amount of time in seconds
41
to delay the loading of this new url. This function will automatically
42
urlencode the passed url and message. If you use this script directly,
43
you will need to urlencode your data manually.
44
45
=cut
46
47
use strict;
48
use warnings;
49
50
use C4::Auth;
51
use C4::Context;
52
use C4::Output;
53
use CGI;
54
55
use vars qw($debug);
56
57
BEGIN {
58
    $debug = $ENV{DEBUG} || 0;
59
}
60
61
my $input = new CGI;
62
63
my $url     = $input->param('url');
64
my $message = $input->param('message');
65
my $delay   = $input->param('delay');
66
67
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
68
    {
69
        template_name   => "tools/delay-load.tmpl",
70
        query           => $input,
71
        type            => "intranet",
72
        authnotrequired => 0,
73
        debug           => $debug,
74
    }
75
);
76
77
$template->param(
78
    url     => $url,
79
    message => $message,
80
    delay   => $delay,
81
);
82
83
output_html_with_http_headers $input, $cookie, $template->output;

Return to bug 7255