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

(-)a/C4/VirtualShelves/Page.pm (-16 / +10 lines)
Lines 379-398 sub shelfpage { Link Here
379
                }
379
                }
380
                my $contents;
380
                my $contents;
381
                ( $contents, $totshelves ) = GetShelfContents( $number, $shelveslimit, $shelvesoffset );
381
                ( $contents, $totshelves ) = GetShelfContents( $number, $shelveslimit, $shelvesoffset );
382
                if ( $totshelves > 0 ) {
382
                my $name=$number;
383
                    unless ( scalar grep { /^CONFIRM-$number$/ } $query->param() ) {
384
                        if ( defined $shelflist->{$number} ) {
385
                            push( @paramsloop, { need_confirm => $shelflist->{$number}->{shelfname}, count => $totshelves, single => ($totshelves eq 1 ? 1:0) } );
386
                            $shelflist->{$number}->{confirm} = $number;
387
                        } else {
388
                            push( @paramsloop, { need_confirm => $privshelflist->{$number}->{shelfname}, count => $totshelves } );
389
                            $privshelflist->{$number}->{confirm} = $number;
390
                        }
391
                        $stay = 0;
392
                        next;
393
                    }
394
                }
395
                my $name;
396
                if ( defined $shelflist->{$number} ) {
383
                if ( defined $shelflist->{$number} ) {
397
                    $name = $shelflist->{$number}->{'shelfname'};
384
                    $name = $shelflist->{$number}->{'shelfname'};
398
                    delete $shelflist->{$number};
385
                    delete $shelflist->{$number};
Lines 423-430 sub shelfpage { Link Here
423
    my @shelveslooppriv;
410
    my @shelveslooppriv;
424
    my $numberCanManage = 0;
411
    my $numberCanManage = 0;
425
412
426
    # rebuild shelflist in case a shelf has been added
413
    # rebuild shelflist
427
    ( $shelflist, $totshelves ) = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser ) unless $delflag;
414
    ( $shelflist, $totshelves ) = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser );
415
    if( $shelvesoffset > 0 && !keys %$shelflist ) {
416
        #retry if we deleted the last list of the page
417
        $shelfoff--;
418
        $shelvesoffset-= $shelflimit;
419
        $template->param( shelfoff => $shelfoff );
420
        ( $shelflist, $totshelves ) = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser );
421
    }
428
    foreach my $element ( sort { lc( $shelflist->{$a}->{'shelfname'} ) cmp lc( $shelflist->{$b}->{'shelfname'} ) } keys %$shelflist ) {
422
    foreach my $element ( sort { lc( $shelflist->{$a}->{'shelfname'} ) cmp lc( $shelflist->{$b}->{'shelfname'} ) } keys %$shelflist ) {
429
        my %line;
423
        my %line;
430
        $shelflist->{$element}->{shelf} = $element;
424
        $shelflist->{$element}->{shelf} = $element;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt (-21 / +3 lines)
Lines 91-97 $(document).ready(function(){ Link Here
91
91
92
	function confirmDelete(message){
92
	function confirmDelete(message){
93
		if (window.confirm(message)) {
93
		if (window.confirm(message)) {
94
		    location.href="/cgi-bin/koha/virtualshelves/shelves.pl?[% IF ( showprivateshelves ) %]display=privateshelves&[% END %]shelves=1&DEL-[% shelfnumber %]=1&shelfoff=[% shelfoff %]";
94
		    location.href="/cgi-bin/koha/virtualshelves/shelves.pl?[% IF ( showprivateshelves ) %]display=privateshelves&[% END %]shelves=1&DEL-[% shelfnumber %]=1&CONFIRM-[% shelfnumber %]&shelfoff=[% shelfoff %]";
95
		} else { 
95
		} else { 
96
			return false;
96
			return false;
97
		}
97
		}
Lines 232-247 function placeHold () { Link Here
232
		[% IF ( paramsloo.status ) %]<div class="dialog alert">[% paramsloo.string %]</div>[% END %]
232
		[% IF ( paramsloo.status ) %]<div class="dialog alert">[% paramsloo.string %]</div>[% END %]
233
		[% IF ( paramsloo.nobarcode ) %]<div class="dialog alert">ERROR: No barcode given.</div>[% END %] 
233
		[% IF ( paramsloo.nobarcode ) %]<div class="dialog alert">ERROR: No barcode given.</div>[% END %] 
234
        [% IF ( paramsloo.noshelfnumber ) %]<div class="dialog alert">ERROR: No list number given.</div>[% END %]
234
        [% IF ( paramsloo.noshelfnumber ) %]<div class="dialog alert">ERROR: No list number given.</div>[% END %]
235
		[% IF ( paramsloo.need_confirm ) %]
236
		<div class="dialog alert">The list <i>[% paramsloo.need_confirm %]</i> is not empty.
237
            [% IF ( paramsloo.single ) %]
238
                <br />It has <b>[% paramsloo.count %]</b> entry.
239
            [% ELSE %]
240
                <br />It has <b>[% paramsloo.count %]</b> entries.
241
            [% END %]
242
			<br />Use the "Confirm" button below to confirm deletion.
243
		</div>
244
		[% END %]
245
		[% IF ( paramsloo.nopermission ) %]
235
		[% IF ( paramsloo.nopermission ) %]
246
		<div class="dialog alert">ERROR: You do not have adequate permission for that action on list [% paramsloo.nopermission %].</div>
236
		<div class="dialog alert">ERROR: You do not have adequate permission for that action on list [% paramsloo.nopermission %].</div>
247
		[% END %]
237
		[% END %]
Lines 562-573 function placeHold () { Link Here
562
					<input type="hidden" name="shelves" value="1" />
552
					<input type="hidden" name="shelves" value="1" />
563
                    <input type="hidden" name="display" value="privateshelves" />
553
                    <input type="hidden" name="display" value="privateshelves" />
564
					<input type="hidden" name="DEL-[% shelveslooppri.shelf %]" value="1" />
554
					<input type="hidden" name="DEL-[% shelveslooppri.shelf %]" value="1" />
565
					[% IF ( shelveslooppri.confirm ) %]
555
					<input type="hidden" name="CONFIRM-[% shelveslooppri.shelf %]" value="1" />
566
					<input type="hidden" name="CONFIRM-[% shelveslooppri.confirm %]" value="1" />
567
					<input type="submit" class="approve" value="Confirm" />
568
					[% ELSE %]
569
                    <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
556
                    <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
570
					[% END %]
571
				</form>
557
				</form>
572
			[% ELSE %]
558
			[% ELSE %]
573
				None
559
				None
Lines 610-621 function placeHold () { Link Here
610
				        <input type="hidden" name="shelfoff" value="[% shelfoff %]" />
596
				        <input type="hidden" name="shelfoff" value="[% shelfoff %]" />
611
					<input type="hidden" name="shelves" value="1" />
597
					<input type="hidden" name="shelves" value="1" />
612
					<input type="hidden" name="DEL-[% shelvesloo.shelf %]" value="1" />
598
					<input type="hidden" name="DEL-[% shelvesloo.shelf %]" value="1" />
613
					[% IF ( shelvesloo.confirm ) %]
599
					<input type="hidden" name="CONFIRM-[% shelvesloo.shelf %]" value="1" />
614
					<input type="hidden" name="CONFIRM-[% shelvesloo.confirm %]" value="1" />
615
					<input type="submit" class="approve" value="Confirm" />
616
					[% ELSE %]
617
                    <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
600
                    <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
618
					[% END %]
619
				</form>
601
				</form>
620
			[% ELSE %]
602
			[% ELSE %]
621
				None
603
				None
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt (-18 / +5 lines)
Lines 113-125 Link Here
113
                            [% IF ( paramsloo.status ) %]<div class="alert">[% paramsloo.string %]</div>[% END %]
113
                            [% IF ( paramsloo.status ) %]<div class="alert">[% paramsloo.string %]</div>[% END %]
114
                            [% IF ( paramsloo.nobarcode ) %]<div class="alert">ERROR: No barcode given.</div>[% END %]
114
                            [% IF ( paramsloo.nobarcode ) %]<div class="alert">ERROR: No barcode given.</div>[% END %]
115
                            [% IF ( paramsloo.noshelfnumber ) %]<div class="alert">ERROR: No shelfnumber given.</div>[% END %]
115
                            [% IF ( paramsloo.noshelfnumber ) %]<div class="alert">ERROR: No shelfnumber given.</div>[% END %]
116
                            [% IF ( paramsloo.need_confirm ) %]
117
                              <div class="alert">
118
                                The list <i>[% paramsloo.need_confirm %]</i> is not empty.
119
                                <br />It has <b>[% paramsloo.count %]</b> [% IF ( paramsloo.single ) %]entry[% ELSE %]entries[% END %].
120
                                <br />Use the "Confirm" button below to confirm deletion.
121
                             </div>
122
                            [% END %]
123
                            [% IF ( paramsloo.nopermission ) %]
116
                            [% IF ( paramsloo.nopermission ) %]
124
                              <div class="alert">ERROR: You do not have adequate permission for that action on list [% paramsloo.nopermission |html%].</div>
117
                              <div class="alert">ERROR: You do not have adequate permission for that action on list [% paramsloo.nopermission |html%].</div>
125
                            [% END %]
118
                            [% END %]
Lines 493-498 Link Here
493
                                        <form method="post" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
486
                                        <form method="post" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
494
                                            <input type="hidden" value="1" name="shelves"/>
487
                                            <input type="hidden" value="1" name="shelves"/>
495
                                            <input type="hidden" value="1" name="DEL-[% shelfnumber %]"/>
488
                                            <input type="hidden" value="1" name="DEL-[% shelfnumber %]"/>
489
                                            <input type="hidden" value="1" name="CONFIRM-[% shelfnumber %]"/>
496
                                            [% IF ( showprivateshelves ) %]
490
                                            [% IF ( showprivateshelves ) %]
497
                                                <input type="hidden" name="display" value="privateshelves"/>
491
                                                <input type="hidden" name="display" value="privateshelves"/>
498
                                            [% END %]
492
                                            [% END %]
Lines 519-524 Link Here
519
                    [% ELSIF ( !itemsloop && manageshelf ) %]
513
                    [% ELSIF ( !itemsloop && manageshelf ) %]
520
                        <form method="post" action="opac-shelves.pl">
514
                        <form method="post" action="opac-shelves.pl">
521
                        <input type="hidden" name="DEL-[% shelfnumber %]" value="1" />
515
                        <input type="hidden" name="DEL-[% shelfnumber %]" value="1" />
516
                        <input type="hidden" name="CONFIRM-[% shelfnumber %]" value="1" />
522
                        <input type="hidden" name="shelves" value="1" />
517
                        <input type="hidden" name="shelves" value="1" />
523
                        <input type="hidden" name="shelfoff" value="[% shelfoff %]" />
518
                        <input type="hidden" name="shelfoff" value="[% shelfoff %]" />
524
                        <input type="submit" class="btn btn-danger" value="Delete this list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST)" />
519
                        <input type="submit" class="btn btn-danger" value="Delete this list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST)" />
Lines 654-666 Link Here
654
                                                                            <input type="hidden" name="shelves" value="1" />
649
                                                                            <input type="hidden" name="shelves" value="1" />
655
                                                                            <input type="hidden" name="display" value="privateshelves" />
650
                                                                            <input type="hidden" name="display" value="privateshelves" />
656
                                                                            <input type="hidden" name="DEL-[% shelveslooppri.shelf %]" value="1" />
651
                                                                            <input type="hidden" name="DEL-[% shelveslooppri.shelf %]" value="1" />
652
                                                                            <input type="hidden" name="CONFIRM-[% shelveslooppri.shelf %]" value="1" />
657
                                                                            <input type="hidden" name="shelfoff" value="[% shelfoff %]" />
653
                                                                            <input type="hidden" name="shelfoff" value="[% shelfoff %]" />
658
                                                                            [% IF ( shelveslooppri.confirm ) %]
659
                                                                                <input type="hidden" name="CONFIRM-[% shelveslooppri.confirm %]" value="1" />
660
                                                                                <input type="submit" class="btn btn-danger confirm" value="Confirm" />
661
                                                                            [% ELSE %]
662
                                                                                <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
654
                                                                                <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
663
                                                                            [% END %]
664
                                                                        </form>
655
                                                                        </form>
665
                                                                            [% IF Koha.Preference('OpacAllowSharingPrivateLists') %]
656
                                                                            [% IF Koha.Preference('OpacAllowSharingPrivateLists') %]
666
                                                                                <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% shelveslooppri.shelf %]" class="">Share</a>
657
                                                                                <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% shelveslooppri.shelf %]" class="">Share</a>
Lines 726-738 Link Here
726
                                                                </form>
717
                                                                </form>
727
                                                                <form action="opac-shelves.pl" method="post" class="form-inline">
718
                                                                <form action="opac-shelves.pl" method="post" class="form-inline">
728
                                                                    <input type="hidden" name="shelves" value="1" />
719
                                                                    <input type="hidden" name="shelves" value="1" />
720
                                                                    <input type="hidden" name="shelfoff" value="[% shelfoff %]" />
729
                                                                    <input type="hidden" name="DEL-[% shelvesloo.shelf %]" value="1" />
721
                                                                    <input type="hidden" name="DEL-[% shelvesloo.shelf %]" value="1" />
730
                                                                    [% IF ( shelvesloo.confirm ) %]
722
                                                                    <input type="hidden" name="CONFIRM-[% shelvesloo.shelf %]" value="1" />
731
                                                                        <input type="hidden" name="CONFIRM-[% shelvesloo.confirm %]" value="1" />
732
                                                                        <input type="submit" class="btn btn-danger confirm" value="Confirm" />
733
                                                                    [% ELSE %]
734
                                                                        <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
723
                                                                        <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
735
                                                                    [% END %]
736
                                                                </form>
724
                                                                </form>
737
                                                            [% END %]&nbsp;
725
                                                            [% END %]&nbsp;
738
                                                        </td>
726
                                                        </td>
739
- 

Return to bug 6279